|
slang-netlist
0.9.0
|
#include <DirectedGraph.hpp>
Public Types | |
| using | NodePtrType = std::unique_ptr<NodeType> |
| using | NodeListType = std::vector<NodePtrType> |
| using | iterator = typename NodeListType::iterator |
| using | const_iterator = typename NodeListType::const_iterator |
| using | node_descriptor = size_t |
| using | edge_descriptor = EdgeType * |
| using | DirectedGraphType = DirectedGraph<NodeType, EdgeType> |
Public Member Functions | |
| DirectedGraph ()=default | |
| auto | begin () const -> const_iterator |
| auto | end () const -> const_iterator |
| auto | begin () -> iterator |
| auto | end () -> iterator |
| auto | findNode (const NodeType &nodeToFind) const -> node_descriptor |
| auto | getNode (node_descriptor node) const -> NodeType & |
| Given a node descriptor, return the node by reference. | |
| auto | addNode () -> NodeType & |
| auto | addNode (std::unique_ptr< NodeType > node) -> NodeType & |
| auto | removeNode (NodeType &nodeToRemove) -> bool |
| auto | addEdge (NodeType &sourceNode, NodeType &targetNode) -> EdgeType & |
| Add an edge between two existing nodes in the graph. | |
| auto | addNewEdge (NodeType &sourceNode, NodeType &targetNode) -> EdgeType & |
| auto | removeEdge (NodeType &sourceNode, NodeType &targetNode) -> bool |
| auto | outDegree (const NodeType &node) const -> size_t |
| Return the number of edges outgoing from the specified node. | |
| auto | inDegree (const NodeType &node) const -> size_t |
| Return the number of edges incident to the specified node. | |
| auto | numNodes () const -> size_t |
| Return the size of the graph. | |
| auto | numEdges () const -> size_t |
| Return the number of edges in the graph. | |
Static Public Attributes | |
| static const size_t | null_node = std::numeric_limits<size_t>::max() |
Protected Attributes | |
| std::mutex | nodesMutex |
| NodeListType | nodes |
A directed graph. Nodes and edges are stored in an adjacency list data structure, where the DirectedGraph contains a vector of nodes, and each node contains a vector of directed edges to other nodes. Multi-edges are not permitted.
| using slang::netlist::DirectedGraph< NodeType, EdgeType >::const_iterator = typename NodeListType::const_iterator |
| using slang::netlist::DirectedGraph< NodeType, EdgeType >::DirectedGraphType = DirectedGraph<NodeType, EdgeType> |
| using slang::netlist::DirectedGraph< NodeType, EdgeType >::edge_descriptor = EdgeType * |
| using slang::netlist::DirectedGraph< NodeType, EdgeType >::iterator = typename NodeListType::iterator |
| using slang::netlist::DirectedGraph< NodeType, EdgeType >::node_descriptor = size_t |
| using slang::netlist::DirectedGraph< NodeType, EdgeType >::NodeListType = std::vector<NodePtrType> |
| using slang::netlist::DirectedGraph< NodeType, EdgeType >::NodePtrType = std::unique_ptr<NodeType> |
|
default |
|
inline |
Add an edge between two existing nodes in the graph.
|
inline |
Unconditionally add a new edge between two existing nodes, even if one already exists (creating a parallel edge).
|
inline |
Add a node to the graph and return a reference to it.
Thread safety: safe to call concurrently from multiple threads.
|
inline |
Add an existing node to the graph and return a reference to it.
Thread safety: safe to call concurrently from multiple threads.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Given a node descriptor, return the node by reference.
|
inline |
Return the number of edges incident to the specified node.
|
inline |
Return the number of edges in the graph.
|
inline |
Return the size of the graph.
|
inline |
Return the number of edges outgoing from the specified node.
|
inline |
Remove an edge between the two specified vertices. Return true if the edge exists and was removed, and false if it didn't exist.
|
inline |
Remove the specified node from the graph, including all edges that are incident upon this node, and all edges that are outgoing from this node. Return true if the node exists and was removed and false if it didn't exist.
|
protected |
|
mutableprotected |
Mutex protecting the nodes vector. Only addNode() acquires this; iteration and read-only access are safe after build() completes.
|
static |