$darkmode
DENOPTIM
denoptim.graph.Ring Class Reference

This class represents the closure of a ring in a spanning tree. More...

Collaboration diagram for denoptim.graph.Ring:
[legend]

Classes

class  DENOPTIMRingSerializer
 

Public Member Functions

 Ring ()
 
 Ring (List< Vertex > vertices)
 
void addVertex (Vertex v)
 Append a DENOPTIMVertex to the list. More...
 
Vertex getHeadVertex ()
 
Vertex getTailVertex ()
 
Vertex getVertexAtPosition (int i)
 
int indexOf (Vertex v)
 Returns the index of the first occurrence of the specified element in this ring, or -1 if this list does not contain the element. More...
 
int getSize ()
 
BondType getBondType ()
 
void setBondType (BondType bndType)
 Set the bond type (i.e., bond order) of the chord connecting the head and the tail vertices. More...
 
boolean contains (Vertex v)
 Checks whether a given vertex is part of this ring. More...
 
boolean containsID (int vid)
 Checks whether a given vertex is part of this ring. More...
 
String toString ()
 
List< VertexgetVertices ()
 
void removeVertex (Vertex oldVrtx)
 
void replaceVertex (Vertex oldVrtx, Vertex newVrtx)
 Replaces a vertex that belong to this ring with a new one. More...
 
boolean insertVertex (int position, Vertex newLink)
 Adds a vertex to the ring, in the given position. More...
 
boolean insertVertex (Vertex newLink, Vertex vA, Vertex vB)
 Adds a vertex to the ring, and in between two defined vertices. More...
 
int getDistance (Vertex v1, Vertex v2) throws DENOPTIMException
 Measures how many edges there are between two edges along the sequence of vertices that defined this fundamental ring. More...
 
Vertex getCloserToHead (Vertex vA, Vertex vB)
 Chooses among the two given vertices the one that is closer to the head vertex. More...
 
Vertex getCloserToTail (Vertex vA, Vertex vB)
 Chooses among the two given vertices the one that is closer to the tail vertex. More...
 
Vertex getCloserTo (Vertex vA, Vertex vB, Vertex vT)
 Chooses among the two given vertices the one that is closer to the target vertex. More...
 
int getPositionOf (Vertex v)
 

Private Attributes

List< Vertexvertices
 List of DENOPTIMVertex involved in the ring. More...
 
BondType bndTyp = BondType.UNDEFINED
 Bond type (i.e., bond order) to be used between head and tail vertices. More...
 

Detailed Description

This class represents the closure of a ring in a spanning tree.

Author
Marco Foscato

Definition at line 39 of file Ring.java.

Constructor & Destructor Documentation

◆ Ring() [1/2]

denoptim.graph.Ring.Ring ( )

Definition at line 53 of file Ring.java.

References denoptim.graph.Ring.vertices.

◆ Ring() [2/2]

denoptim.graph.Ring.Ring ( List< Vertex vertices)

Definition at line 60 of file Ring.java.

References denoptim.graph.Ring.vertices.

Member Function Documentation

◆ addVertex()

void denoptim.graph.Ring.addVertex ( Vertex  v)

Append a DENOPTIMVertex to the list.

Definition at line 71 of file Ring.java.

References denoptim.graph.Ring.vertices.

Referenced by denoptim.ga.GraphOperationsTest.addRings(), denoptim.graph.DGraph.clone(), denoptim.graph.DGraph.DENOPTIMGraphDeserializer.deserialize(), and denoptim.graph.DGraph.makeAllGraphsWithDifferentRingSets().

Here is the caller graph for this function:

◆ contains()

boolean denoptim.graph.Ring.contains ( Vertex  v)

Checks whether a given vertex is part of this ring.

Parameters
vthe candidate DENOPTIMVertex
Returns
true if the given vertex is contained in the list of DENOPTIMVertexs involved in this ring

Definition at line 172 of file Ring.java.

References denoptim.graph.Ring.vertices.

Referenced by denoptim.graph.Ring.getCloserTo(), denoptim.graph.Ring.getDistance(), and denoptim.graph.Ring.insertVertex().

Here is the caller graph for this function:

◆ containsID()

boolean denoptim.graph.Ring.containsID ( int  vid)

Checks whether a given vertex is part of this ring.

Parameters
vidthe ID of the candidate DENOPTIMVertex
Returns
true if the list of DENOPTIMVertexs involved in this ring contains the given vertex ID

Definition at line 187 of file Ring.java.

References denoptim.graph.Ring.vertices.

◆ getBondType()

BondType denoptim.graph.Ring.getBondType ( )
Returns
the bond type (i.e., bond order) of the chord connecting the head and the tail vertices

Definition at line 146 of file Ring.java.

References denoptim.graph.Ring.bndTyp.

Referenced by denoptim.graph.Ring.DENOPTIMRingSerializer.serialize().

Here is the caller graph for this function:

◆ getCloserTo()

Vertex denoptim.graph.Ring.getCloserTo ( Vertex  vA,
Vertex  vB,
Vertex  vT 
)

Chooses among the two given vertices the one that is closer to the target vertex.

Parameters
vAfirst candidate.
vBsecond candidate.
vTthe target vertex.
Returns
the vertex closer to the target vertex.

Definition at line 378 of file Ring.java.

References denoptim.graph.Ring.contains(), and denoptim.graph.Ring.getDistance().

Referenced by denoptim.graph.Ring.getCloserToHead(), denoptim.graph.Ring.getCloserToTail(), and denoptim.graph.RingTest.testGetCloserVertex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCloserToHead()

Vertex denoptim.graph.Ring.getCloserToHead ( Vertex  vA,
Vertex  vB 
)

Chooses among the two given vertices the one that is closer to the head vertex.

Parameters
vAfirst candidate.
vBsecond candidate
Returns
the vertex closer to the head.

Definition at line 349 of file Ring.java.

References denoptim.graph.Ring.getCloserTo(), and denoptim.graph.Ring.vertices.

Referenced by denoptim.graph.RingTest.testGetCloserVertex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCloserToTail()

Vertex denoptim.graph.Ring.getCloserToTail ( Vertex  vA,
Vertex  vB 
)

Chooses among the two given vertices the one that is closer to the tail vertex.

Parameters
vAfirst candidate.
vBsecond candidate
Returns
the vertex closer to the tail.

Definition at line 363 of file Ring.java.

References denoptim.graph.Ring.getCloserTo(), and denoptim.graph.Ring.vertices.

Referenced by denoptim.graph.RingTest.testGetCloserVertex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDistance()

int denoptim.graph.Ring.getDistance ( Vertex  v1,
Vertex  v2 
) throws DENOPTIMException

Measures how many edges there are between two edges along the sequence of vertices that defined this fundamental ring.

Parameters
v1
v2
Returns
the distance between the vertices (i.e., number of edges).
Exceptions
DENOPTIMExceptionif either vertex is not part of this ring.

Definition at line 325 of file Ring.java.

References denoptim.graph.Ring.contains(), and denoptim.graph.Ring.vertices.

Referenced by denoptim.graph.Ring.getCloserTo(), denoptim.graph.RingTest.testGetDistance(), and denoptim.graph.DGraphTest.testReplaceSubGraph_inTemplate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHeadVertex()

Vertex denoptim.graph.Ring.getHeadVertex ( )
Returns
the first vertex in the list of DENOPTIMVertexs involved in this ring

Definition at line 83 of file Ring.java.

References denoptim.graph.Ring.vertices.

Referenced by denoptim.graph.DGraph.sameAsRings(), and denoptim.graph.DGraphTest.testReplaceSubGraph_inTemplate().

Here is the caller graph for this function:

◆ getPositionOf()

int denoptim.graph.Ring.getPositionOf ( Vertex  v)
Parameters
vthe vertex to search for
Returns
the index of that vertex (first instance), or -1 if that vertex is not part of the ring.

Definition at line 415 of file Ring.java.

References denoptim.graph.Ring.vertices.

Referenced by denoptim.graph.DGraph.removeChainUpToBranching().

Here is the caller graph for this function:

◆ getSize()

int denoptim.graph.Ring.getSize ( )
Returns
the size of the list of DENOPTIMVertexs involved in this ring

Definition at line 134 of file Ring.java.

References denoptim.graph.Ring.vertices.

Referenced by denoptim.graph.DGraph.removeChainUpToBranching(), denoptim.graph.DGraph.sameAsRings(), and denoptim.graph.Ring.DENOPTIMRingSerializer.serialize().

Here is the caller graph for this function:

◆ getTailVertex()

Vertex denoptim.graph.Ring.getTailVertex ( )
Returns
the last vertex in the list of DENOPTIMVertexs involved in this ring

Definition at line 95 of file Ring.java.

References denoptim.graph.Ring.vertices.

Referenced by denoptim.graph.DGraph.sameAsRings(), and denoptim.graph.DGraphTest.testReplaceSubGraph_inTemplate().

Here is the caller graph for this function:

◆ getVertexAtPosition()

Vertex denoptim.graph.Ring.getVertexAtPosition ( int  i)
Returns
the vertex at the given position in the list of DENOPTIMVertexs involved in this ring

Definition at line 107 of file Ring.java.

References denoptim.graph.Ring.vertices.

Referenced by denoptim.graph.DGraph.removeChainUpToBranching(), denoptim.graph.DGraph.sameAsRings(), denoptim.graph.Ring.DENOPTIMRingSerializer.serialize(), and denoptim.graph.RingTest.testGetCloserVertex().

Here is the caller graph for this function:

◆ getVertices()

List< Vertex > denoptim.graph.Ring.getVertices ( )

Definition at line 214 of file Ring.java.

References denoptim.graph.Ring.vertices.

Referenced by denoptim.graph.DGraph.extractPattern().

Here is the caller graph for this function:

◆ indexOf()

int denoptim.graph.Ring.indexOf ( Vertex  v)

Returns the index of the first occurrence of the specified element in this ring, or -1 if this list does not contain the element.

Definition at line 122 of file Ring.java.

References denoptim.graph.Ring.vertices.

Referenced by denoptim.graph.RingTest.testUndirectedComparison().

Here is the caller graph for this function:

◆ insertVertex() [1/2]

boolean denoptim.graph.Ring.insertVertex ( int  position,
Vertex  newLink 
)

Adds a vertex to the ring, in the given position.

Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Parameters
positionthe position where the vertex will be found after insertion.
newLinkvertex to add to this ring.
Returns
true if the vertex is inserted, or false if the operation cannot be performed for any reason, e.g., the vertex is already contained in this ring.

Definition at line 275 of file Ring.java.

References denoptim.graph.Ring.contains(), and denoptim.graph.Ring.vertices.

Referenced by denoptim.graph.RingTest.testUndirectedComparison().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertVertex() [2/2]

boolean denoptim.graph.Ring.insertVertex ( Vertex  newLink,
Vertex  vA,
Vertex  vB 
)

Adds a vertex to the ring, and in between two defined vertices.

Parameters
newLinkvertex to add to this ring.
vAone of the vertices in between which the new vertex should in inserted.
vBone of the vertices in between which the new vertex should in inserted.
Returns
true if the vertex is inserted, or false if the operation cannot be performed for any reason, e.g., the vertex is already contained in this ring, or either of the two reference vertices are not themselves contained here.

Definition at line 298 of file Ring.java.

References denoptim.graph.Ring.contains(), and denoptim.graph.Ring.vertices.

Here is the call graph for this function:

◆ removeVertex()

void denoptim.graph.Ring.removeVertex ( Vertex  oldVrtx)

Definition at line 242 of file Ring.java.

References denoptim.graph.Ring.vertices.

◆ replaceVertex()

void denoptim.graph.Ring.replaceVertex ( Vertex  oldVrtx,
Vertex  newVrtx 
)

Replaces a vertex that belong to this ring with a new one.

Parameters
oldVrtxthe vertex to be replaced.
newVrtxthe vertex the replace the old one with.

Definition at line 255 of file Ring.java.

References denoptim.graph.Ring.vertices.

◆ setBondType()

void denoptim.graph.Ring.setBondType ( BondType  bndType)

Set the bond type (i.e., bond order) of the chord connecting the head and the tail vertices.

Definition at line 158 of file Ring.java.

Referenced by denoptim.graph.DGraph.addRing(), denoptim.graph.DGraph.clone(), denoptim.graph.rings.CyclicGraphHandler.combineCompatPathSubGraphs(), denoptim.graph.DGraph.DENOPTIMGraphDeserializer.deserialize(), denoptim.graph.DGraph.makeAllGraphsWithDifferentRingSets(), and denoptim.graph.rings.RandomCombOfRingsIterator.next().

Here is the caller graph for this function:

◆ toString()

String denoptim.graph.Ring.toString ( )
Returns
the string representation of this ring

Definition at line 208 of file Ring.java.

References denoptim.graph.Ring.vertices.

Member Data Documentation

◆ bndTyp

BondType denoptim.graph.Ring.bndTyp = BondType.UNDEFINED
private

Bond type (i.e., bond order) to be used between head and tail vertices.

Definition at line 49 of file Ring.java.

Referenced by denoptim.graph.Ring.getBondType().

◆ vertices


The documentation for this class was generated from the following file: