Graph reference¶
Graph
¶
Bases:
Network graph class.
__init__()
¶
Initialize the graph.
add_edge(u_of_edge, v_of_edge, **attr)
¶
Add an edge to the graph.
add_edge_bidir(u_of_edge, v_of_edge, **attr)
¶
Add a bidirectional edge to the graph.
add_node(node_for_adding, **attr)
¶
Add a node to the graph.
add_nodes_as_array(name, array, node_type, *, edge_type='', node_obj=None, edge_obj=None, connect=True)
¶
Add nodes as an array.
add_nodes_as_tree(parent, tree, node_type, edge_type, *, lvl=0, node_obj=None, edge_obj=None, connect=True)
¶
Add nodes as a tree.
create_unique_ep_id(node)
¶
Return the endpoint id.
get_edge_obj(edge)
¶
Return the edge object.
get_edges(filters=None, with_obj=True, with_name=False)
¶
Filter the edges from the graph.
get_edges_from(node, filters=None, with_obj=True, with_name=False)
¶
Return the outgoing edges from the node.
get_edges_of(node, filters=None, with_obj=True, with_name=False)
¶
Return the edges of the node.
get_edges_to(node, filters=None, with_obj=True, with_name=False)
¶
Return the incoming edges to the node.
get_ep_nodes(with_obj=True, with_name=False)
¶
Return the endpoint nodes.
get_link_edges(with_obj=True, with_name=False)
¶
Return the link edges.
get_ni_nodes(with_obj=True, with_name=False)
¶
Return the ni nodes.
get_node_arr_dim(node)
¶
Return the node array dimension.
get_node_arr_idx(node)
¶
Return the node array index.
get_node_id(node_name=None, node_obj=None)
¶
Return the node id.
get_node_lvl(node)
¶
Return the node level.
get_node_obj(node)
¶
Return the node object.
get_node_uid(node_name=None, node_obj=None)
¶
Return the unique node id.
get_nodes(filters=None, with_obj=True, with_name=False)
¶
Filter the nodes from the graph.
get_nodes_from_idx(node, idx)
¶
Return the nodes from the index.
get_nodes_from_lvl(node, lvl)
¶
Return the nodes from the level.
get_nodes_from_range(node, rng)
¶
Return the nodes from the range.
get_prot_edges(with_obj=True, with_name=False)
¶
Return the protocol edges.
get_rt_nodes(with_obj=True, with_name=False)
¶
Return the router nodes.
is_ep_node(node)
¶
Return whether the node is an endpoint node.
is_link_edge(edge)
¶
Return whether the edge is a link edge.
is_ni_node(node)
¶
Return whether the node is an ni node.
is_prot_edge(edge)
¶
Return whether the edge is a protocol edge.
is_rt_node(node)
¶
Return whether the node is a router node.
set_edge_obj(edge, obj)
¶
Set the edge object.
set_node_obj(node, obj)
¶
Set the node object.