Package dev.roanh.cpqindex
Class Nauty.ColoredGraph
java.lang.Object
dev.roanh.cpqindex.Nauty.ColoredGraph
- Enclosing class:
- Nauty
Represents a coloured graph. Colours are assigned to 4 categories
in this graph:
- Each label is represented by a colour.
- The source vertex is represented by a colour.
- The target vertex is represented by a colour unless the target vertex equals the source vertex.
- Any remaining vertices are represented by a colour if any.
-
Field Summary
Modifier and TypeFieldDescriptionprivate int[][]
The adjacency list representing the graph.A collection of lists where each list has the IDs of nodes with the same colour.private int[]
List of node IDs that have no label.private int
The ID of the source vertex of the graph.private int
The ID of the target vertex of the graph. -
Constructor Summary
ConstructorDescriptionColoredGraph
(int[][] adj, int source, int target, List<Map.Entry<dev.roanh.gmark.core.graph.Predicate, int[]>> labels, int[] nolabel) Constructs a new coloured graph with the given adjacency list and colour information. -
Method Summary
Modifier and TypeMethodDescriptionint[][]
Gets the adjacency list representation of this graph.List<int[]>
Gets the colour information of this graph as a list of lists where each list has the IDs of vertices of the same colour.Gets a list of colour information in the form of a list of entries where each entry has the colour label and IDs of vertices with that colour.int
Gets the total number of nodes in this graph.int[]
Gets the IDs of nodes without a label/colour.
-
Field Details
-
graph
private int[][] graphThe adjacency list representing the graph. -
labels
A collection of lists where each list has the IDs of nodes with the same colour. The label for the colour is also present in each entry. Excludes the special collection of nodes without label. The list items are sorted on predicate ID. -
noLabel
private int[] noLabelList of node IDs that have no label. -
source
private int sourceThe ID of the source vertex of the graph. -
target
private int targetThe ID of the target vertex of the graph.
-
-
Constructor Details
-
ColoredGraph
public ColoredGraph(int[][] adj, int source, int target, List<Map.Entry<dev.roanh.gmark.core.graph.Predicate, int[]>> labels, int[] nolabel) Constructs a new coloured graph with the given adjacency list and colour information.- Parameters:
adj
- The adjacency list of the graph.source
- The node ID of the source vertex of the graph.target
- The node ID of the target vertex of the graph.labels
- A list of node IDs for each label.nolabel
- A list of node IDs without any label.
-
-
Method Details
-
getNodeCount
public int getNodeCount()Gets the total number of nodes in this graph.- Returns:
- The total number of nodes in this graph.
-
getNoLabels
public int[] getNoLabels()Gets the IDs of nodes without a label/colour.- Returns:
- The IDs of nodes without a label/colour.
-
getLabels
Gets a list of colour information in the form of a list of entries where each entry has the colour label and IDs of vertices with that colour.- Returns:
- Gets the IDs of the coloured vertices and labels.
-
getColorLists
Gets the colour information of this graph as a list of lists where each list has the IDs of vertices of the same colour.- Returns:
- The colour information as a list of lists.
-
getAdjacencyList
public int[][] getAdjacencyList()Gets the adjacency list representation of this graph.- Returns:
- The adjacency list representation of this graph.
-