public class AdjacencyListGraph extends AbstractGraph
A lightweight graph class intended to allow the construction of big graphs (millions of elements).
The main purpose here is to minimize memory consumption even if the
management of such a graph implies more CPU consuming. See the
complexity tags on each method so as to figure out the impact on
the CPU.
AbstractElement.AttributeChangeEventReplayable.Controller| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_EDGE_CAPACITY |
static int |
DEFAULT_NODE_CAPACITY |
static double |
GROW_FACTOR |
| Constructor and Description |
|---|
AdjacencyListGraph(String id)
Creates an empty graph with strict checking and without auto-creation.
|
AdjacencyListGraph(String id,
boolean strictChecking,
boolean autoCreate)
Creates an empty graph with default edge and node capacity.
|
AdjacencyListGraph(String id,
boolean strictChecking,
boolean autoCreate,
int initialNodeCapacity,
int initialEdgeCapacity)
Creates an empty graph.
|
| Modifier and Type | Method and Description |
|---|---|
<T extends Edge> |
getEdge(int index)
Get an edge by its index.
|
<T extends Edge> |
getEdge(String id)
Get an edge by its identifier.
|
int |
getEdgeCount()
Number of edges in this graph.
|
<T extends Edge> |
getEdgeIterator()
Iterator on the set of edges, in an undefined order.
|
<T extends Node> |
getNode(int index)
Get a node by its index.
|
<T extends Node> |
getNode(String id)
Get a node by its identifier.
|
int |
getNodeCount()
Number of nodes in this graph.
|
<T extends Node> |
getNodeIterator()
Iterator on the set of nodes, in an undefined order.
|
addAttributeSink, addEdge, addEdge, addEdge, addEdge, addEdge, addEdge, addElementSink, addNode, addSink, attributeSinks, clear, clearAttributeSinks, clearElementSinks, clearSinks, display, display, edgeAdded, edgeAttributeAdded, edgeAttributeChanged, edgeAttributeRemoved, edgeFactory, edgeRemoved, elementSinks, getEachEdge, getEachNode, getEdgeSet, getNodeSet, getReplayController, getStep, graphAttributeAdded, graphAttributeChanged, graphAttributeRemoved, graphCleared, isAutoCreationEnabled, isStrict, iterator, nodeAdded, nodeAttributeAdded, nodeAttributeChanged, nodeAttributeRemoved, nodeFactory, nodeRemoved, nullAttributesAreErrors, read, read, removeAttributeSink, removeEdge, removeEdge, removeEdge, removeEdge, removeEdge, removeEdge, removeElementSink, removeNode, removeNode, removeNode, removeSink, setAutoCreate, setEdgeFactory, setNodeFactory, setNullAttributesAreErrors, setStrict, stepBegins, stepBegins, write, writeaddAttribute, addAttributes, changeAttribute, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getEachAttributeKey, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttribute, toStringequals, getClass, hashCode, notify, notifyAll, wait, wait, waitaddAttribute, addAttributes, changeAttribute, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getEachAttributeKey, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttributepublic static final double GROW_FACTOR
public static final int DEFAULT_NODE_CAPACITY
public static final int DEFAULT_EDGE_CAPACITY
public AdjacencyListGraph(String id, boolean strictChecking, boolean autoCreate, int initialNodeCapacity, int initialEdgeCapacity)
id - Unique identifier of the graph.strictChecking - If true any non-fatal error throws an exception.autoCreate - If true (and strict checking is false), nodes are
automatically created when referenced when creating a edge,
even if not yet inserted in the graph.initialNodeCapacity - Initial capacity of the node storage data structures. Use this
if you know the approximate maximum number of nodes of the
graph. The graph can grow beyond this limit, but storage
reallocation is expensive operation.initialEdgeCapacity - Initial capacity of the edge storage data structures. Use this
if you know the approximate maximum number of edges of the
graph. The graph can grow beyond this limit, but storage
reallocation is expensive operation.public AdjacencyListGraph(String id, boolean strictChecking, boolean autoCreate)
id - Unique identifier of the graph.strictChecking - If true any non-fatal error throws an exception.autoCreate - If true (and strict checking is false), nodes are
automatically created when referenced when creating a edge,
even if not yet inserted in the graph.public AdjacencyListGraph(String id)
id - Unique identifier of the graph.public <T extends Edge> T getEdge(String id)
Graph
ExtendedEdge edge = graph.getEdge("...");
the method will return an ExtendedEdge edge. If no left part exists,
method will just return an Edge.getEdge in interface GraphgetEdge in class AbstractGraphid - Identifier of the edge to find.public <T extends Edge> T getEdge(int index)
GraphExtendedEdge edge = graph.getEdge(index);the method will return an ExtendedEdge edge. If no left part exists, method will just return an Edge.
getEdge in interface GraphgetEdge in class AbstractGraphindex - The index of the edge to find.public int getEdgeCount()
StructuregetEdgeCount in interface StructuregetEdgeCount in class AbstractGraphpublic <T extends Node> T getNode(String id)
Graph
ExtendedNode node = graph.getNode("...");
the method will return an ExtendedNode node. If no left part exists,
method will just return a Node.getNode in interface GraphgetNode in class AbstractGraphid - Identifier of the node to find.public <T extends Node> T getNode(int index)
GraphExtendedNode node = graph.getNode(index);the method will return an ExtendedNode node. If no left part exists, method will just return a Node.
getNode in interface GraphgetNode in class AbstractGraphindex - Index of the node to find.public int getNodeCount()
StructuregetNodeCount in interface StructuregetNodeCount in class AbstractGraphpublic <T extends Edge> Iterator<T> getEdgeIterator()
StructureIterator<ExtendedEdge> ite = graph.getEdgeIterator();the method will return an Iterator<ExtendedEdge>. If no left part exists, method will just return an Iterator<Edge>.
getEdgeIterator in interface StructuregetEdgeIterator in class AbstractGraphpublic <T extends Node> Iterator<T> getNodeIterator()
StructureIterator<ExtendedNode> ite = graph.getNodeIterator();the method will return an Iterator<ExtendedNode>. If no left part exists, method will just return an Iterator<Node>.
getNodeIterator in interface StructuregetNodeIterator in class AbstractGraphCopyright © 2015. All rights reserved.