XNetwork 1.7.5; VERSION ${PROJECT_VERSION}
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations
xnetwork Namespace Reference

Classes

struct  AmbiguousSolution
 Raised when more than one valid solution exists for an intermediary step of an algorithm. More...
 
class  DiGraphS
 Directed graph with arbitrary node types. More...
 
struct  ExceededMaxIterations
 Raised when a loop exceeds the maximum number of iterations. More...
 
class  Graph
 Undirected graph with arbitrary node types. More...
 
class  Greeter
 A class that generates localized greeting messages. More...
 
struct  HasACycle
 Raised if a graph has a cycle when an algorithm expects no cycles. More...
 
struct  NodeNotFound
 Exception raised when a requested node is not present in the graph. More...
 
class  NodeView
 NodeView class - acts as gra.nodes() for an XNetwork Graph. More...
 
class  thread_pool
 
struct  XNetworkAlgorithmError
 Exception for unexpected termination of algorithms. More...
 
struct  XNetworkError
 Exception for a serious error in XNetwork. More...
 
struct  XNetworkException
 Base class for all XNetwork exceptions. More...
 
struct  XNetworkNoCycle
 Exception for algorithms that should return a cycle when running on graphs where such a cycle does not exist. More...
 
struct  XNetworkNoPath
 Exception for algorithms that should return a path when running on graphs where such a path does not exist. More...
 
struct  XNetworkNotImplemented
 Exception raised by algorithms not implemented for a type of graph. More...
 
struct  XNetworkPointlessConcept
 Raised when a null graph is provided as input to an algorithm that cannot use it. More...
 
struct  XNetworkUnbounded
 Exception raised when a maximization or minimization problem instance is unbounded. More...
 
struct  XNetworkUnfeasible
 Exception raised by algorithms trying to solve a problem instance that has no feasible solution. More...
 

Typedefs

using SimpleDiGraphS = DiGraphS< decltype(py::range< uint32_t >(uint32_t{})), py::dict< uint32_t, int >, std::vector< py::dict< uint32_t, int > > >
 A simple directed graph with integer nodes.
 
using SimpleGraph = Graph< decltype(py::range< uint32_t >(uint32_t{})), py::set< uint32_t >, std::vector< py::set< uint32_t > > >
 A simple undirected graph with integer nodes.
 

Enumerations

enum class  LanguageCode { EN , DE , ES , FR }
 Language codes supported for greetings. More...
 

Detailed Description

View Classes provide node, edge and degree "views" of a graph.

Views for nodes, edges and degree are provided for all base graph classes. A view means a read-only object that is quick to create, automatically updated when the graph changes, and provides basic access like n : V, for n : V, V[n] and sometimes set operations.

The views are read-only iterable containers that are updated as the graph is updated. As with dicts, the graph should not be updated while (iterating through the view. Views can be iterated multiple times.

Edge and Node views also allow data attribute lookup. The resulting attribute dict is writable as gra.edges[3, 4]["color"]="red" Degree views allow lookup of degree values for single nodes. Weighted degree is supported with the weight argument.

NodeView

`V = gra.nodes` (or `V = gra.nodes()`) allows `len(V)`, `n : V`, set
operations e.g. "gra.nodes & H.nodes", and `dd = gra.nodes[n]`, where
`dd` is the node data dict. Iteration is over the nodes by default.

NodeDataView

To iterate over (node, data) pairs, use arguments to `gra.nodes()`
to create a DataView e.g. `DV = gra.nodes(data="color", default="red")`.
The DataView iterates as `for n, color : DV` and allows
`(n, "red"] : DV`. Using `DV = gra.nodes(data=true)`, the DataViews
use the full datadict : writeable form also allowing contain testing as
`(n, {"color": "red"}] : VD`. DataViews allow set operations when
data attributes are hashable.

DegreeView

`V = gra.degree` allows iteration over (node, degree) pairs as well
as lookup: `deg=V[n]`. There are many flavors of DegreeView
for In/Out/Directed/Multi. For Directed Graphs, `gra.degree`
counts both : and out going edges. `gra.out_degree` &&
`gra.in_degree` count only specific directions.
Weighted degree using edge data attributes is provide via
`V = gra.degree(weight="attr_name")` where any string with the
attribute name can be used. `weight=None` is the default.
No set operations are implemented for degrees, use NodeView.

The argument `nbunch` restricts iteration to nodes : nbunch.
The DegreeView can still lookup any node even if (nbunch is specified.

EdgeView

`V = gra.edges` or `V = gra.edges()` allows iteration over edges as well as
`e : V`, set operations and edge data lookup `dd = gra.edges[2, 3]`.
Iteration is over 2-tuples `(u, v)` for Graph/DiGraph. For multigraphs
edges 3-tuples `(u, v, key)` are the default but 2-tuples can be obtained
via `V = gra.edges(keys=false)`.

Set operations for directed graphs treat the edges as a set of 2-tuples.
For undirected graphs, 2-tuples are not a unique representation of edges.
So long as the set being compared to contains unique representations
of its edges, the set operations will act as expected. If the other
set contains both `(0, 1)` and `(1, 0)` however, the result of set
operations may contain both representations of the same edge.

EdgeDataView

Edge data can be reported using an EdgeDataView typically created
by calling an EdgeView: `DV = gra.edges(data="weight", default=1)`.
The EdgeDataView allows iteration over edge tuples, membership checking
but no set operations.

Iteration depends on `data` and `default` and for multigraph `keys`
If `data == false` (the default) then iterate over 2-tuples `(u, v)`.
If `data is true` iterate over 3-tuples `(u, v, datadict)`.
Otherwise iterate over `(u, v, datadict.get(data, default))`.
For Multigraphs, if (`keys is true`, replace `u, v` with `u, v, key`
to create 3-tuples and 4-tuples.

The argument `nbunch` restricts edges to those incident to nodes : nbunch.

Typedef Documentation

◆ SimpleDiGraphS

A simple directed graph with integer nodes.

Convenience alias for a DiGraphS with uint32_t nodes and vector-based adjacency storage

◆ SimpleGraph

A simple undirected graph with integer nodes.

Convenience alias for a Graph with uint32_t nodes and vector-based adjacency storage

Enumeration Type Documentation

◆ LanguageCode

Language codes supported for greetings.

Specifies the available language options for generating localized greeting messages.

Enumerator
EN 

English.

DE 

German.

ES 

Spanish.

FR 

French.