/** * Basis analysis of a graph * * @param tg graph to analyse */ public static void analyse(timgraph tg) { basicroot = tg.inputName.getNameRoot(); tg.calcStrength(); FileOutput fo = new FileOutput(tg); boolean vertexListOn = true; boolean printTriangles = true; boolean printSquares = true; boolean printNearestNeighbours = false; boolean edgeListOn = true; boolean graphMLOn = false; fo.informationGeneral( "", SEP, vertexListOn, printTriangles, printSquares, printNearestNeighbours, edgeListOn, graphMLOn, tg.outputControl); // fo.informationGeneral("", SEP); // fo.edgeListSimple(); // if (tg.isVertexLabelled()) fo.printEdges(true, false, false, false, false); }
/** * Basic routine to analyse a given graph. * * <p>BasicAnalysis arguments are just the usual <tt>timgraph</tt> arguments. Specify input file * name and graph characteristics using timgraph arguments and the outputs will be those defined * by the <tt>OutputControl</tt> class. * * @param args <tt>timgraph</tt> the command line arguments * @see TimGraph.timgraph#printUsage * @see TimGraph.OutputMode */ public static void main(String[] args) { System.out.println( "BasicAnalysis Arguments: just specify file name and characteristics using timgraph arguments alone"); System.out.println(" Output is controled by OutputMode argument -oNNN"); OutputMode o = new OutputMode(255); o.printUsage(System.out, ""); // String basicFileName="TGCGn1x6y6t108p0"; // String basicFileName="aegean39S1L3a_v1_3e-1.0j0.0m0.5k1.0l4.5b1.2D100.0MC_r4_edgeweight"; // String basicFileName="MSC-2010classbygroup"; // String basicFileName="MSC-2010subclassbygroup"; // String [] aList = { "-fir"+basicFileName, "-fieinputBVNLS.dat", "-o511"}; // String basicFileName="RAEmanAuthorPaper"; // String [] aList = { "-fin"+basicFileName+"inputBVNLS.dat", "-o511"}; // String basicFileName="karateTSE"; // String [] aList = { "-fin"+basicFileName, "-fieinputEL.dat", "-o511"}; // String basicFileName="UKHEI08"; // String [] aList = { "-fin"+basicFileName, "-fieinputLAM.dat", "-gn99", "-e0", "-o255", // "-xi0"}; // String basicFileName="BiTest"; // String [] aList = { "-fin"+basicFileName, "-fieinputBVNLS.dat", "-gn99", "-e0", "-o255", // "-xi0"}; // String basicFileName="burtinputELS.dat"; // String [] aList = { "-fin"+basicFileName,"-fisinput/burt","-fosoutput/burt","-o511"}; // String basicFileName="vaneshtestinput.net"; // String [] aList = { "-fin"+basicFileName,"-fisinput/vanesh","-fosoutput/vanesh","-o511", // "-xv10", "-xe20"}; // String basicFileName="testinputELS.dat"; // String [] aList = { "-fin"+basicFileName,"-fisinput/Test","-fosoutput/Test","-o7", // "-xv10", "-xe20"}; String basicFileName = "UKwardsSEJDinputELS.dat"; String[] aList = {"-fin" + basicFileName, "-fisinput/UKwards", "-fosoutput/UKwards", "-o511"}; if (args.length > 0) aList = args; tg = new timgraph(); tg.parseParam(aList); tg.outputControl.printMode(System.out, " "); tg.setNameRoot(tg.inputName.getNameRoot()); // tg.setNetworkFromManyInputFiles(); // this will read in the network // tg.printParametersBasic(); int xColumn = 1; int yColumn = 2; boolean headerOn = false; boolean infoOn = false; int nameColumn = 1; tg.setNetworkFromInputFiles(); // tg.setNetworkFromManyInputFiles(xColumn, yColumn, nameColumn, headerOn, infoOn); // this will // read in the network tg.printParametersBasic(); System.out.println("Output: " + tg.outputControl.getModeString(" ")); if (tg.getNumberVertices() < 20) tg.printNetwork(true); analyse(tg); }
/** @param args the command line arguments */ public static void main(String[] args) { SetUpNetwork setnet = new SetUpNetwork(infoLevel); // String name="SFWANPDFV05bright3cons025"; // int n=0; String name = "SFWANPDFV05cons025"; int ano = 0; if (args.length > ano) if (args[ano].charAt(0) == '*') { name = args[ano].substring(1, args[ano].length()); } String wordName = "bright"; ano++; if (args.length > ano) if (args[ano].charAt(0) == '*') { wordName = args[ano].substring(1, args[ano].length()); } // set cutoff for strength within community in final graph, if less than one using fractional, // otherwise aboslute double min = 0.9; ano++; if (args.length > ano) if (args[ano].charAt(0) == '*') { min = Double.parseDouble(args[ano].substring(1, args[ano].length())); } boolean normaliseOn; if (min < 1.0) normaliseOn = true; else normaliseOn = false; System.out.println( "--- Looking at file name " + name + " for subgraph centred on word " + wordName + ", " + (normaliseOn ? "fractional " : "absolute ") + "cutoff " + min); String[] aList = { "-gvet", "-gdf", "-gewt", "-gelt", "-gvlt", "-fin" + name, "-fieinputELS.dat", "-gn99", "-e0", "-o11", "-xi0" }; timgraph big = setnet.setUpNetwork(name, aList, infoLevel); if ((infoLevel > 0) && big.getNumberVertices() < 20) big.printNetwork(true); TreeSet labelSet = big.getEdgeLabelSet(); int numberLabelsBig = labelSet.size(); System.out.println( "Network " + big.inputName.getNameRoot() + " has " + numberLabelsBig + " distinct labels"); FileOutput fobig = new FileOutput(big); fobig.printEdges(true, false, false, false, true); fobig.graphMLEdgePartition(numberLabelsBig); // String epname="LouvainQSWLGEP_"; // // VertexPartition ep = new VertexPartition(epname,big.getNumberStubs()/2); // ep.readIntPartition(big.inputName.getNameRootFullPath()+"inputEP.dat", 1, 2, false); // // big.setEdgeLabels(ep); // need edge weights on as labels carry the partition tg = big.makeEdgeSubGraph( wordName, false, true, big.isVertexLabelled(), big.isVertexEdgeListOn()); // tg.setNameRoot(epname+wordName+"V_"); tg.printParametersBasic(); if ((infoLevel > 0) && tg.getNumberVertices() < 20) tg.printNetwork(true); int numberLabels = tg.relabelEdges(wordName); System.out.println( "Network " + tg.inputName.getNameRoot() + " has " + numberLabels + " distinct labels around word " + wordName); labelSet = tg.getEdgeLabelSet(); int numberLabelsTotal = labelSet.size(); System.out.println( "Network " + tg.inputName.getNameRoot() + " has " + numberLabelsTotal + " distinct labels "); // output graph as is. // tg.setNameRoot(name+"edgeSG"); FileOutput fo = new FileOutput(tg); fo.informationGeneral("", SEP); fo.printEdges(true, false, false, false, true); fo.graphMLEdgePartition(numberLabels); boolean splitBipartite = false; boolean outputType1 = false; fo.printEdgeCommunityStats(true, true, splitBipartite, outputType1); // min value set as third parameter double min=0.9; int imin = (int) (min * 1000); TreeSet<Integer> sgvertexList = tg.edgeLabelToVertexSet(min, normaliseOn, false); int vvv = tg.getVertexFromName(wordName); sgvertexList.add(vvv); timgraph newgraph = tg.projectSubgraph( "", sgvertexList, tg.isDirected(), tg.isVertexLabelled(), tg.isWeighted(), tg.isVertexEdgeListOn(), tg.isBipartite()); String ending; // ="f"+((int)(min*1000)); if (normaliseOn) ending = "f" + ((int) (min * 1000)); else ending = "a" + min; newgraph.setNameRoot(newgraph.inputName.getNameRoot() + "_" + "EP2VC" + ending); labelSet = newgraph.getEdgeLabelSet(); numberLabelsTotal = labelSet.size(); System.out.println( "Network " + newgraph.inputName.getNameRoot() + " has " + numberLabelsTotal + " distinct labels "); FileOutput fon = new FileOutput(newgraph); fon.informationGeneral("", SEP); fon.graphMLEdgePartition(numberLabels); splitBipartite = false; outputType1 = false; fon.printEdgeCommunityStats(true, true, splitBipartite, outputType1); }