12#include <py2cpp/py2cpp.hpp>
33 template <
typename nodeview_t,
typename adjlist_t = py::dict<Value_type<nodeview_t>,
int>,
34 typename adjlist_outer_dict_factory = py::dict<Value_type<nodeview_t>, adjlist_t>>
35 class DiGraphS :
public Graph<nodeview_t, adjlist_t, adjlist_outer_dict_factory> {
40 using edge_t = std::pair<Node, Node>;
60 using T =
decltype(this->
_adj);
67 using T =
decltype(this->
_adj);
120 typename std::enable_if<std::is_same<U, value_type>::value>
::type {
132 typename std::enable_if<!std::is_same<U, value_type>::value>
::type {
Read-only map of maps of maps (view into a dict-of-dict-of-dict structure)
Definition coreviews.hpp:109
AdjacencyView(Atlas &d)
Construct an AdjacencyView from an Atlas container.
Definition coreviews.hpp:115
auto at(const T &key) const -> const auto &
Access element at specified key (const version)
Definition coreviews.hpp:79
auto size() const -> size_t
Get the number of elements in the view.
Definition coreviews.hpp:49
Directed graph with arbitrary node types.
Definition digraphs.hpp:35
typename _Base::key_type key_type
Definition digraphs.hpp:44
auto adj() const
Get adjacency mapping (successors) of the directed graph (const version)
Definition digraphs.hpp:59
auto successors(const Node &node) const -> const auto &
Get iterator over successors of a node (const)
Definition digraphs.hpp:182
auto succ() const
Get the successors mapping (same as adj)
Definition digraphs.hpp:66
auto has_successor(const Node &node_u, const Node &node_v) const -> bool
Check if a node has a specific successor.
Definition digraphs.hpp:170
auto add_edge(const Node &node_u, const Node &node_v, const T &data)
Add an edge between two nodes with data.
Definition digraphs.hpp:146
auto is_directed() const
Check if the graph is directed.
Definition digraphs.hpp:214
typename _Base::value_type value_type
Definition digraphs.hpp:45
auto number_of_edges() const -> size_t
Get the number of edges in the directed graph.
Definition digraphs.hpp:192
auto add_edge(const Node &node_u, const Node &node_v) -> typename std::enable_if<!std::is_same< U, value_type >::value >::type
Add an edge between two nodes (for complex key type)
Definition digraphs.hpp:131
typename _Base::Node Node
Definition digraphs.hpp:39
auto add_edges_from(const C1 &edges, const C2 &data)
Add edges from a container with associated data.
Definition digraphs.hpp:158
DiGraphS(const nodeview_t &Nodes)
Construct a directed graph from a node container.
Definition digraphs.hpp:52
std::pair< Node, Node > edge_t
Definition digraphs.hpp:40
auto is_multigraph() const
Check if the graph is a multigraph.
Definition digraphs.hpp:210
DiGraphS(uint32_t num_nodes)
Construct a directed graph with a given number of integer nodes.
Definition digraphs.hpp:56
auto successors(const Node &node) -> auto &
Get iterator over successors of a node (non-const)
Definition digraphs.hpp:177
auto clear()
Remove all nodes and edges from the graph.
Definition digraphs.hpp:201
auto degree(const Node &node) const
Get the out-degree of a node in the directed graph.
Definition digraphs.hpp:187
auto add_edge(const Node &node_u, const Node &node_v) -> typename std::enable_if< std::is_same< U, value_type >::value >::type
Add a directed edge between two nodes (for simple key type, SFINAE)
Definition digraphs.hpp:119
Undirected graph with arbitrary node types.
Definition graph.hpp:43
typename adjlist_t::value_type value_type
Definition graph.hpp:56
auto edges() const -> std::vector< edge_t >
Return a vector of all edges as (u, v) pairs.
Definition graph.hpp:223
_nodeview_t nodeview_t
Definition graph.hpp:45
typename adjlist_t::key_type key_type
Definition graph.hpp:55
nodeview_t _node
Container holding all nodes in the graph.
Definition graph.hpp:63
typename nodeview_t::value_type Node
Definition graph.hpp:46
adjlist_outer_dict_factory _adj
Adjacency dictionary keyed by node.
Definition graph.hpp:66
Read-only view classes for graph data structures.
Undirected graph data structure for XNetwork.
Definition digraphs.hpp:24
View classes for nodes, edges, and degrees in XNetwork graphs.