Java Code Examples for

Following code examples demonstrate how to use android. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use various code implementation of this class.

    public AdjacencyListGraph(int numOfVerticex, Graph.typeOfGraph typeOfGraph) {
        this.numOfVerticex = numOfVerticex;
        this.typeOfGraph = typeOfGraph;
        adjacencyList = new Node[numOfVerticex];
        visited = new Boolean[numOfVerticex];
        for (int i = 0; i < numOfVerticex; i++) {
            adjacencyList[i] = null;
        for (int i = 0; i < numOfVerticex; i++) {
            visited[i] = false;
        stack = new Stack<>();


    public USAGraph(int maxNumNodes) {
        this.maxNumNodes = maxNumNodes;
        nodes = new CityNode[maxNumNodes];
        adjacencyList = new Edge[maxNumNodes];


An AdjacencyList is used to store the history of certification paths attempted in constructing a pat

h from an initiator to a target. The AdjacencyList is initialized with a List of Lists, where each sub- List contains objects of type Vertex. A Vertex describes one possible or actual step in the chain building process, and the associated Certificate. Specifically, a Vertex object contains a Certificate and an index value referencing the next sub-list in the process. If the index value is -1 then this Vertex doesn't continue the attempted build path.


Attempted Paths: C1->C2->C3 C1->C4->C5 C1->C4->C6 C1->C4->C7 C1->C8->C9 C1->C10->C11

AdjacencyList structure: AL[0] = C1,1 AL[1] = C2,2 =>C4,3 =>C8,4 =>C10,5 AL[2] = C3,-1 AL[3] = C5,-1 =>C6,-1 =>C7,-1 AL[4] = C9,-1 AL[5] = C11,-1

The iterator method returns objects of type BuildStep, not objects of type Vertex. A BuildStep contains a Vertex and a result code, accessible via getResult method. There are five result values. POSSIBLE denotes that the current step represents a Certificate that the builder is considering at this point in the build. FOLLOW denotes a Certificate (one of those noted as POSSIBLE) that the builder is using to try extending the chain. BACK represents that a FOLLOW was incorrect, and is being removed from the chain. There is exactly one FOLLOW for each BACK. The values SUCCEED and FAIL mean that we've come to the end of the build process, and there will not be any more entries in the list.

@see @see

@author seth proctor @since 1.4

Read More