DistributionGraph#
- class shift.DistributionGraph#
A class representing distribution system as a graph.
Internally, graph data is stored using networkx Graph instance.
Examples
>>> dgraph = DistributionGraph()
Adding a node the system.
>>> from shift import NodeModel >>> dgraph.add_node(NodeModel(name="node_1"))
Adding multiple nodes to the system.
>>> from gdm import DistributionLoad >>> dgraph.add_nodes([NodeModel(name="node_2", assets={DistributionLoad}), NodeModel(name="node_3")])
Adding an edge to the system.
>>> from shift import EdgeModel >>> dgraph.add_edge("node_1", "node_2", edge_data=EdgeModel(name="node1_node2", edge_type=DistributionBranchBase))
Getting node data.
>>> dgraph.get_node("node_1")
Getting all nodes.
>>> dgraph.get_nodes()
Getting filtered nodes.
>>> dgraph.get_nodes(filter_func=lambda x: len(x.assets) == 0)
Remove a node.
>>> dgraph.remove_node("node_2")
Methods#
|
|
|
Adds node to the graph. |
|
Adds multiple nodes to the graph. |
|
Adds edge to the graph. |
|
Get node data by node name. |
|
Returns list of nodes. |
|
Removes a node from the system. |
|
Get edge data. |
|
Removes an edge from the system. |
|
Method to return undirected graph. |
|
Internal method to directed dfs tree from vsource. |