0001 function [maxwt, intedges, stredges] = kernel2(G,s)
0002 % KERNEL2 : SSCA#2 Kernel 2 -- Classify Large Sets
0003 %
0004 % [maxwt, intedges, stredges] = kernel2 (G, s) 
0005 % Input:  G is a directed, weighted multigraph (see kernel1 for details)
0006 %         s is the string to be searched
0007 % Output: maxwt     is the maximum integer weight in the graph
0008 %         intedges  is the set of edges with integer label maxwt
0009 %         stredges  is the set of edges with string label s
0010 %   each row of intedges and stredges is an edge [startvtx endvtx].
0011 %
0012 % At present the string label search is not yet implemented.
0013 %
0014 % This is a concise sequential Matlab code by John R. Gilbert, 
0015 % based loosely on searchWeights in V0.9 of the executable spec 
0016 % by Bill Mann and Theresa Meuse.
0017 % Version of 21 Feb 2005
0018 
0019 ng = length(G.edgeWeights); % number of graphs = max # of parallel edges
0020 
0021 maxwt = 0;
0022 for g = 1:ng
0023     maxwt = max(maxwt, max(max(G.edgeWeights{g})));
0024 end
0025 
0026 intedges = zeros(0,2);
0027 stredges = zeros(0,2);
0028 % sindices = find(G.strings etc);
0029 for g = 1:ng
0030     [intstart intend] = find(G.edgeWeights{g} == maxwt);
0031 %   [strstart strend] = find(G.edgeWeights{g} is any of the sindices);
0032     intedges = [intedges ; intstart intend];
0033 %   stredges = [stredges ; strstart strend];
0034 end;