N - node typepublic class SimpleMapGraph<N> extends Object implements MutableGraph<N,N,N,Void>, ShrinkableGraph<N,N>
This class provides maximum flexibility, but should only be used if performance is not a major concern.
SimpleGraph.NormalGraphView<N,G extends SimpleGraph<N>>| Constructor and Description |
|---|
SimpleMapGraph()
|
SimpleMapGraph(Map<N,Collection<N>> structureMap)
Initializes a graph using the given adjacency structure, and adjacency information for a single node is stored
using
HashSets. |
SimpleMapGraph(Map<N,Collection<N>> structureMap,
Supplier<? extends Collection<N>> adjCollSupplier)
Initializes a graph using the given adjacency structure, and adjacency information for a single node is stored in
data structures created via the provided supplier.
|
SimpleMapGraph(Supplier<? extends Collection<N>> adjCollSupplier)
Initializes a graph where the adjacency structure is stored using a
HashMap, and adjacency information
for a single node is stored in data structures created via the provided supplier. |
| Modifier and Type | Method and Description |
|---|---|
N |
addNode(N property)
Adds a new node to the graph.
|
Iterator<N> |
adjacentTargetsIterator(N node) |
Stream<N> |
adjacentTargetsStream(N node) |
N |
connect(N source,
N target,
Void property)
Inserts an edge in the graph.
|
Collection<N> |
getAdjacentTargets(N node) |
Void |
getEdgeProperty(N edge)
Retrieves the property of a given edge.
|
N |
getNodeProperty(N node)
Retrieves the property of a given node.
|
Set<N> |
getNodes()
Retrieves an (unmodifiable) collection of the nodes in this graph.
|
Collection<N> |
getOutgoingEdges(N node)
Retrieves the outgoing edges of a given node.
|
N |
getTarget(N edge)
Retrieves, for a given edge, its target node.
|
Iterator<N> |
iterator() |
void |
removeEdge(N node,
N edge)
Removes an outgoing edge from the given node.
|
void |
removeNode(N node,
N replacement)
Removes a node from this graph, and redirects all incoming edges to the given replacement node (node that
outgoing edges are still removed).
|
void |
setEdgeProperty(N edge,
Void property) |
void |
setNodeProperty(N node,
N property)
Deprecated.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddNode, connectasNormalGraph, getVisualizationHelpernodeIDs, nodesStream, sizeforEach, spliteratorgetEdgesBetween, outgoingEdges, outgoingEdgesIterator, outgoingEdgesStreamadjacentTargets, createDynamicNodeMapping, createStaticNodeMapping, isConnectedremoveNodepublic SimpleMapGraph()
public SimpleMapGraph(Supplier<? extends Collection<N>> adjCollSupplier)
HashMap, and adjacency information
for a single node is stored in data structures created via the provided supplier.adjCollSupplier - the supplier for per-node adjacency collectionspublic SimpleMapGraph(Map<N,Collection<N>> structureMap)
HashSets.structureMap - the map for the overall graph structurepublic SimpleMapGraph(Map<N,Collection<N>> structureMap, Supplier<? extends Collection<N>> adjCollSupplier)
structureMap - the map for the overall graph structureadjCollSupplier - the supplier for per-node adjacency collectionspublic Iterator<N> adjacentTargetsIterator(N node)
adjacentTargetsIterator in interface IndefiniteGraph<N,N>adjacentTargetsIterator in interface IndefiniteSimpleGraph<N>public Collection<N> getAdjacentTargets(N node)
getAdjacentTargets in interface IndefiniteGraph<N,N>getAdjacentTargets in interface IndefiniteSimpleGraph<N>public Stream<N> adjacentTargetsStream(N node)
adjacentTargetsStream in interface IndefiniteGraph<N,N>adjacentTargetsStream in interface IndefiniteSimpleGraph<N>public Collection<N> getOutgoingEdges(N node)
IndefiniteGraphgetOutgoingEdges in interface IndefiniteGraph<N,N>node - the node.Collection of all outgoing edges, or null if the node has no outgoing edges.public N getTarget(N edge)
IndefiniteGraphgetTarget in interface IndefiniteGraph<N,N>edge - the edge.public Set<N> getNodes()
SimpleGraphgetNodes in interface SimpleGraph<N>public N getNodeProperty(N node)
UniversalIndefiniteGraphgetNodeProperty in interface UniversalIndefiniteGraph<N,N,N,Void>node - the nodepublic Void getEdgeProperty(N edge)
UniversalIndefiniteGraphgetEdgeProperty in interface UniversalIndefiniteGraph<N,N,N,Void>edge - the edgepublic N addNode(N property)
MutableGraphpublic N connect(N source, N target, Void property)
MutableGraph@Deprecated public void setNodeProperty(N node, N property)
setNodeProperty in interface MutableGraph<N,N,N,Void>public void setEdgeProperty(N edge, Void property)
setEdgeProperty in interface MutableGraph<N,N,N,Void>public void removeNode(N node, N replacement)
ShrinkableGraphnull replacement is specified, then this function behaves
equivalently to the above ShrinkableGraph.removeNode(Object).removeNode in interface ShrinkableGraph<N,N>node - the node to removereplacement - the replacement node for incoming edgespublic void removeEdge(N node, N edge)
ShrinkableGraphremoveEdge in interface ShrinkableGraph<N,N>node - the nodeedge - the edge to removeCopyright © 2020. All rights reserved.