Package net.automatalib.graph
Class SimpleMapGraph<N>
- java.lang.Object
-
- net.automatalib.graph.SimpleMapGraph<N>
-
- Type Parameters:
N- node type
- All Implemented Interfaces:
Iterable<N>,FiniteRepresentation,Graph<N,N>,IndefiniteGraph<N,N>,IndefiniteSimpleGraph<N>,MutableGraph<N,N,N,Void>,ShrinkableGraph<N,N>,SimpleGraph<N>,UniversalGraph<N,N,N,Void>,UniversalIndefiniteGraph<N,N,N,Void>
public class SimpleMapGraph<@Nullable N> extends Object implements MutableGraph<N,N,N,Void>, ShrinkableGraph<N,N>
A very simple graph realization, where nodes can be arbitrary Java objects. This graph does not support edge properties.This class provides maximum flexibility, but should only be used if performance is not a major concern.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.automatalib.graph.Graph
Graph.IntAbstraction<E extends Object>
-
Nested classes/interfaces inherited from interface net.automatalib.graph.MutableGraph
MutableGraph.IntAbstraction<E extends Object,NP extends Object,EP extends Object>
-
-
Constructor Summary
Constructors Constructor Description SimpleMapGraph()SimpleMapGraph(Supplier<? extends Collection<@Nullable N>> adjCollSupplier)Initializes a graph where the adjacency structure is stored using aHashMap, and adjacency information for a single node is stored in data structures created via the provided supplier.SimpleMapGraph(Map<@Nullable N,Collection<@Nullable N>> structureMap)Initializes a graph using the given adjacency structure, and adjacency information for a single node is stored usingHashSets.SimpleMapGraph(Map<@Nullable N,Collection<@Nullable N>> structureMap, Supplier<? extends Collection<@Nullable 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description NaddNode(@Nullable N property)Nconnect(@Nullable N source, @Nullable N target, Void property)Collection<N>getAdjacentNodes(@Nullable N node)Iterator<N>getAdjacentNodesIterator(@Nullable N node)VoidgetEdgeProperty(@Nullable N edge)NgetNodeProperty(@Nullable N node)Set<N>getNodes()Collection<N>getOutgoingEdges(@Nullable N node)NgetTarget(@Nullable N edge)Iterator<N>iterator()voidremoveEdge(@Nullable N node, @Nullable N edge)voidremoveNode(@Nullable N node, @Nullable N replacement)voidsetEdgeProperty(@Nullable N edge, Void property)voidsetNodeProperty(@Nullable N node, @Nullable N property)Deprecated.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.automatalib.graph.Graph
getOutgoingEdgesIterator, getVisualizationHelper
-
Methods inherited from interface net.automatalib.graph.IndefiniteGraph
getEdgesBetween
-
Methods inherited from interface net.automatalib.graph.IndefiniteSimpleGraph
createDynamicNodeMapping, createStaticNodeMapping, isConnected
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface net.automatalib.graph.MutableGraph
addNode, connect
-
Methods inherited from interface net.automatalib.graph.ShrinkableGraph
removeNode
-
Methods inherited from interface net.automatalib.graph.SimpleGraph
nodeIDs, size
-
-
-
-
Constructor Detail
-
SimpleMapGraph
public SimpleMapGraph()
-
SimpleMapGraph
public SimpleMapGraph(Supplier<? extends Collection<@Nullable N>> adjCollSupplier)
Initializes a graph where the adjacency structure is stored using aHashMap, and adjacency information for a single node is stored in data structures created via the provided supplier.- Parameters:
adjCollSupplier- the supplier for per-node adjacency collections
-
SimpleMapGraph
public SimpleMapGraph(Map<@Nullable N,Collection<@Nullable N>> structureMap)
Initializes a graph using the given adjacency structure, and adjacency information for a single node is stored usingHashSets.- Parameters:
structureMap- the map for the overall graph structure
-
SimpleMapGraph
public SimpleMapGraph(Map<@Nullable N,Collection<@Nullable N>> structureMap, Supplier<? extends Collection<@Nullable 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.- Parameters:
structureMap- the map for the overall graph structureadjCollSupplier- the supplier for per-node adjacency collections
-
-
Method Detail
-
getAdjacentNodes
public Collection<N> getAdjacentNodes(@Nullable N node)
- Specified by:
getAdjacentNodesin interfaceGraph<N,N>
-
getAdjacentNodesIterator
public Iterator<N> getAdjacentNodesIterator(@Nullable N node)
- Specified by:
getAdjacentNodesIteratorin interfaceIndefiniteGraph<N,N>- Specified by:
getAdjacentNodesIteratorin interfaceIndefiniteSimpleGraph<N>
-
getOutgoingEdges
public Collection<N> getOutgoingEdges(@Nullable N node)
- Specified by:
getOutgoingEdgesin interfaceGraph<N,N>
-
getTarget
public N getTarget(@Nullable N edge)
- Specified by:
getTargetin interfaceIndefiniteGraph<N,N>
-
getNodes
public Set<N> getNodes()
- Specified by:
getNodesin interfaceSimpleGraph<N>
-
getNodeProperty
public N getNodeProperty(@Nullable N node)
- Specified by:
getNodePropertyin interfaceUniversalIndefiniteGraph<N,N,N,Void>
-
getEdgeProperty
public Void getEdgeProperty(@Nullable N edge)
- Specified by:
getEdgePropertyin interfaceUniversalIndefiniteGraph<N,N,N,Void>
-
setNodeProperty
@Deprecated public void setNodeProperty(@Nullable N node, @Nullable N property)
Deprecated.- Specified by:
setNodePropertyin interfaceMutableGraph<N,N,N,Void>
-
setEdgeProperty
public void setEdgeProperty(@Nullable N edge, Void property)
- Specified by:
setEdgePropertyin interfaceMutableGraph<N,N,N,Void>
-
removeNode
public void removeNode(@Nullable N node, @Nullable N replacement)
- Specified by:
removeNodein interfaceShrinkableGraph<N,N>
-
removeEdge
public void removeEdge(@Nullable N node, @Nullable N edge)
- Specified by:
removeEdgein interfaceShrinkableGraph<N,N>
-
-