0001 function G = kernel1pm(E) 0002 % KERNEL1PM : Poor Man's SSCA#2 Kernel 1 -- Graph Construction 0003 % 0004 % G = kernel1 (E) 0005 % Input: E is a structure representing a list of triples <i,j,w> 0006 % representing directed, weighted edges. 0007 % See genScalData for details. 0008 % Output: G is the graph, a structure containing only one field, 0009 % G.graph, the simple, undirected graph ignoring edge dirs 0010 % 0011 % This is a concise sequential Matlab code by John R. Gilbert, 0012 % based loosely on computeGraph in V1.0 of the executable spec 0013 % by Bill Mann and Theresa Meuse. 0014 % Version of 8 Nov 2005 0015 0016 fprintf ('\n** Constructing undirected graph **\n'); 0017 0018 n = max(max(E.startVertices),max(E.endVertices)); 0019 A = sparse(E.startVertices,E.endVertices,1,n,n); 0020 G.graph = spones(A | A');