Defined in File GraphBuilder.hpp
Public Functions
Creates a new GraphBuilder. GraphBuilder supports the basic methods needed to create a new graph (addNode, addEdge, setWeight, increaseWeight). It is designed to be much faster for graph creation, but the speed comes with a restriction: For undirected graphs GraphBuilder will handle u->v and v->u as two different edges. Keep that in mind when using setWeight and increaseWeight. GraphBuilder allows parallelization in a special way. It’s internal data structure saves edges only at the source node. As long as edges from node u are only added/changed by thread t1, every other thread can modifier edges not starting in u. addNode is not threadsafe.
n – Number of nodes.
weighted – If set to true
, the graph has edge weights.
directed – If set to true
, the graph will be directed.
autoCompleteEdges – If set to true
, the edges will automatically be added to the adjacency lists of both nodes (decreases the time to build).
Returns true
if this graph supports edge weights other than 1.0.
true
if this graph supports edge weights other than 1.0.
Return true
if this graph supports directed edges.
true if this graph supports directed edges.
Return true
if graph contains no nodes.
true
if graph contains no nodes.
Return the number of nodes in the graph.
The number of nodes.
Get an upper bound for the node ids in the graph.
An upper bound for the node ids.
Insert an edge between the nodes u and v. If the graph is weighted you can optionally set a weight for this edge. The default weight is 1.0. If setUseWholeEdges(true) has been called prior, this sets both half edges, which improves the performance of the graph builder.
u – Endpoint of edge.
v – Endpoint of edge.
weight – Optional edge weight.
Set the weight of an edge. If the edge does not exist, it will be inserted.
u – [in] endpoint of edge
v – [in] endpoint of edge
weight – [in] edge weight
Increase the weight of an edge. If the edge does not exist, it will be inserted.
u – [in] endpoint of edge
v – [in] endpoint of edge
weight – [in] edge weight
DEPRECATED: use completeGraph() instead which uses the parallel mode by default (if possible).
Iterate over all nodes of the graph and call handle (lambda closure).
handle – Takes parameter (node)
.
Iterate randomly over all nodes of the graph and call handle (lambda closure).
handle – Takes parameter (node)
.
Iterate over all undirected pairs of nodes and call handle (lambda closure).
handle – Takes parameters (node, node)
.
Iterate over all undirected pairs of nodes in parallel and call handle (lambda closure).
handle – Takes parameters (node, node)
.