code { import java.util.List; import java.net.*; import java.util.ArrayList; import java.util.HashSet; import org.jgrapht.*; import org.jgrapht.alg.KShortestPaths; import org.jgrapht.graph.*; public class GraphManager { UsefulTools useful_tools = new UsefulTools(); public static void main(String[] args) { GraphManager gm = new GraphManager(); UsefulTools useful_tools = new UsefulTools(); System.out.println(useful_tools.getTime()); String airport_network = useful_tools.storeTextFiletoString("C:\\Users\\kurtw_000\\Documents\\kurt\\storage\\CIM Research Folder\\DR\\2013\\11-11-13\\analysis of a variety of networks\\airports\\airport network clean.txt"); /* UndirectedGraph stringGraph = createStringGraph("1\t3\n2\t3"); */ UndirectedGraph stringGraph = createStringGraph(airport_network); // note undirected edges are printed as: {,} System.out.println(gm.averageSearchInformationEntropyOfWholeGraph(stringGraph, 50)); System.out.println(useful_tools.getTime()); } /*** ** Take a string of an edge list format graph, and then build the corresponding JGraphT undirected graph. */ private static UndirectedGraph createStringGraph(String graph_in_edge_list_format) { UndirectedGraph g = new SimpleGraph(DefaultEdge.class); String[] rows = graph_in_edge_list_format.split("\r"); ArrayList vertices = new ArrayList(); for(int i=0; i graph, ArrayList list_of_vertices_in_path) { double return_value = 0; return_value = 1/graph.degreeOf(list_of_vertices_in_path.get(0).toString().replaceAll(" ", "")); //now multiply the reciprocal of the degree minus one for each vertex in the path for(int i=1; i graph, String start_vertex, String end_vertex, int number_of_paths_to_compute_in_shortest_path_calculation) { double return_value = 0; //first get all of the shortest paths from i to b List list_of_shortest_paths = findShortestPaths(graph, start_vertex,end_vertex, number_of_paths_to_compute_in_shortest_path_calculation); //now loop through all the paths and get the sum of the probability of following each path in a random walk for(int path_count=0; path_count graph, int number_of_paths_to_compute_in_shortest_path_calculation) { double sum =0; double number_of_elements_for_sum = 0; ArrayList entropies = new ArrayList(); //get a list of the vertices String s_vertices = graph.vertexSet().toString(); s_vertices = s_vertices.replaceAll("\\[", ""); s_vertices = s_vertices.replaceAll("\\]", ""); s_vertices = s_vertices.replaceAll(" ", ""); ArrayList vertices = useful_tools.stringWithCommasToArrayList(s_vertices); for(int start_vertex_count=0; start_vertex_count