V
- vertex typeE
- edge typepublic class ComplementGraphGenerator<V,E> extends Object implements GraphGenerator<V,E,V>
More formally, let $G = (V, E)$ be a graph and let $K$ consist of all 2-element subsets of $V$. Then $\overline{G} = (V, K \setminus E)$ is the complement of $G$, where $K \setminus E$ is the relative complement of $E$ in $K$. For directed graphs, the complement can be defined in the same way, as a directed graph on the same vertex set, using the set of all 2-element ordered pairs of $V$ in place of the set $K$ in the formula above.
The complement is not defined for multigraphs. If a multigraph is provided as input to this generator, it will be treated as if it is a simple graph.
Constructor and Description |
---|
ComplementGraphGenerator(Graph<V,E> graph)
Complement Graph Generator
|
ComplementGraphGenerator(Graph<V,E> graph,
boolean generateSelfLoops)
Complement Graph Generator.
|
Modifier and Type | Method and Description |
---|---|
void |
generateGraph(Graph<V,E> target,
Map<String,V> resultMap)
Generate a graph structure.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
generateGraph
public ComplementGraphGenerator(Graph<V,E> graph)
graph
- input graphpublic ComplementGraphGenerator(Graph<V,E> graph, boolean generateSelfLoops)
generateSelfLoops
.graph
- input graphgenerateSelfLoops
- indicator whether self loops should be generated. If false, no
self-loops are generated, independent of whether the target graph supports self-loops.public void generateGraph(Graph<V,E> target, Map<String,V> resultMap)
GraphGenerator
generateGraph
in interface GraphGenerator<V,E,V>
target
- receives the generated edges and vertices; if this is non-empty on entry, the
result will be a disconnected graph since generated elements will not be connected to
existing elementsresultMap
- if non-null, receives implementation-specific mappings from String roles to
graph elements (or collections of graph elements)Copyright © 2019. All rights reserved.