Package core.Graphs

Examples of core.Graphs.Graph


//                }
//            }

//                long generatingGraphStartTime = System.nanoTime();
                GraphGenerator generator = new RandomIntervalGraphGenerator();
                Graph graph = (Graph) generator.generate(num);
//                long generatingGraphEndTime = System.nanoTime() - generatingGraphStartTime;
//            System.out.println("Generation graph time is - " + generatingGraphEndTime);
//
////            Graph graph = new Graph(a);
//            System.out.println("The matrix is:");
//            printMatrix(graph.getAdjacencyMatrix());
//            System.out.println();
//
//            long startTime = System.nanoTime();
//            System.out.println("Corresponding perfect elimination ordering is:");
//            long findingOrderStartTime = System.nanoTime();
                graph.findOrder();
//            long findingOrderEndTime = System.nanoTime() - findingOrderStartTime;
//            System.out.println("Finding order time is - " + findingOrderEndTime);
//
//            for (Vertex v : graph.getOrder()) {
//                System.out.print(v.getNumber() + " ");
//            }
//            System.out.println();
//            System.out.println();
//
//            long findingChordalityStartTime = System.nanoTime();
                graph.setChordal(graph.checkChordality());
//            long findingChordalityEndTime = System.nanoTime() - findingChordalityStartTime;
//            System.out.println("Finding chordality time is - " + findingChordalityEndTime);
//            System.out.println("Vertex properties are (RN(x) and parent(x)):");
//            for (int i = 0; i < graph.getVertices().size(); i++) {
//                System.out.print("RN" + "(" + i + "):");
//                System.out.print(graph.getVertices().get(i).getRightNeighbours() + "\t\t");
//                System.out.print("parent" + "(" + i + "):");
//                System.out.print(graph.getVertices().get(i).getParent() + "\t\t");
//                System.out.println();
//            }
//            System.out.println();
//            System.out.println();
//
//            System.out.print("Is graph chordal? ");
//            System.out.println(graph.isChordal());
                if (!graph.isChordal()) {
//                throw new IllegalStateException("GRAPH IS NOT CHORDAL");
                }
//            System.out.println();
//            System.out.println();

                if (graph.isChordal() == true) {
//                System.out.println("Corresponding cliques are:");
//                long cliqueTreeStartTime = System.nanoTime();
                    CliqueTree nodeCliqueTree = graph.findCliqueTree();
//                long cliqueTreeEndTime = System.nanoTime() - cliqueTreeStartTime;
//                System.out.println("Finding clique tree time is - " + cliqueTreeEndTime);
//                System.out.println(nodeCliqueTree.toString());
//                System.out.println();
//                long findingIntervalityStartTime = System.nanoTime();
                    List<Node> cliqueChain = graph.getIntervals(nodeCliqueTree);
//                long findingIntervalityEndTime = System.nanoTime() - findingIntervalityStartTime;
//                System.out.println("Finding intervality time is - " + findingIntervalityEndTime);
//
//                System.out.println("Graph's intervals: ");
//                for (Node interval : intervals) {
//                    System.out.println(interval.toString());
//                }
//                System.out.print("Is graph interval? ");
//                System.out.println(graph.isInterval());
                    if (!graph.isInterval()) {
                    throw new IllegalStateException("GRAPH IS NOT INTERVAL");
                    }
                }

                if (!graph.isInterval() && !graph.isChordal()) {
                    plainGrpahs++;
                }
                if (graph.isInterval()) {
                    intervalGrpahs++;
                }
                if (graph.isChordal() && !graph.isInterval()) {
                    chordalGrpahs++;
                }

//            fileWriter.append(new Long(System.nanoTime() - startTime).toString() + "\n");
View Full Code Here


                adjacencyMatrix[jIndex][i] = 1;
            }
            adjacencyMatrix[i][i] = 0;
        }

        return new Graph(adjacencyMatrix);
    }
View Full Code Here

                }
            }
            adjacencyMatrix[i][i] = 0;
        }

        return new Graph(adjacencyMatrix);
    }
View Full Code Here

                adjacencyMatrix[i][j] = 0;
            }
            adjacencyMatrix[i][i] = 0;
        }

        return new Graph(adjacencyMatrix);
    }
View Full Code Here

                }
            }
            adjacencyMatrix[i][i] = 0;
        }

        return new Graph(adjacencyMatrix);
    }
View Full Code Here

                adjacencyMatrix[i][j] = 1;
            }
            adjacencyMatrix[i][i] = 0;
        }

        return new Graph(adjacencyMatrix);
    }
View Full Code Here

                adjacencyMatrix[nIndex][m] = 1;
            }
            adjacencyMatrix[m][m] = 0;
        }

        return new Graph(adjacencyMatrix);
    }
View Full Code Here

TOP

Related Classes of core.Graphs.Graph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.