public interface GraphBuilder extends Graph
Graph interface offering methods for the addition
of nodes and edges.INTERNAL_NODE_GRAPH_ID| Modifier and Type | Method and Description |
|---|---|
boolean |
addEdge(int sourceId,
int targetId,
int typeId)
Adds a new edge with the given information if possible.
|
int |
addNode()
Adds a new node to the graph and returns its ID.
|
int[] |
addNodes(int nodeCount)
Adds the given number of nodes to the graph and returns the range of node
IDs.
|
default Graph |
build()
Returns a
Graph instance based on the graph data that the builder
collected until now. |
void |
setEntranceNodes(int[] entranceNodes)
Sets the IDs of the entrance nodes (i.e., nodes from which all other nodes
can be reached).
|
void |
setGraphIdOfNode(int nodeId,
int graphId,
int externalId)
Sets the graph ID of the given node.
|
getEntranceNodes, getExternalNodeId, getGraphId, getNumberOfEdges, getNumberOfNodes, incomingEdgeSources, incomingEdgeTypes, outgoingEdgeTargets, outgoingEdgeTypesdefault Graph build()
Graph instance based on the graph data that the builder
collected until now. This instance might offer a faster implementation than
the builder class.Graph instance containing the built graph.boolean addEdge(int sourceId,
int targetId,
int typeId)
true
if the edge could be added.sourceId - the id of the source nodetargetId - the id of the target nodetypeId - the type id of the edgetrue if the edge could be added. Otherwise false is
returned.int addNode()
int[] addNodes(int nodeCount)
nodeCount - the number of nodes that should be addedvoid setEntranceNodes(int[] entranceNodes)
entranceNodes - the IDs of the entrance nodesvoid setGraphIdOfNode(int nodeId,
int graphId,
int externalId)
Graph.INTERNAL_NODE_GRAPH_ID as graph ID meaning that they are part of this
graph. However, to mark external nodes (i.e., nodes that are not part of this
graph but are linked from one of the nodes of this graph), this method can be
used to store their graph ID as well as their ID in the other graph.nodeId - the ID of the node in this graphgraphId - the ID of the graph in the other graph. Use
Graph.INTERNAL_NODE_GRAPH_ID to delete the marking of a node being
external.externalId - the ID of this node inside the other graph (only used if the
graphID != Graph.INTERNAL_NODE_GRAPH_ID)Copyright © 2019–2020. All rights reserved.