Prev: Import of CSDF files
Next: Map vs. Table
From: Dana DeLouis on 6 Apr 2007 04:51 > ..everything is done using an adjacency matrix composed of (0,1)'s If you are working with an AdjacencyMatrix, here's an additional idea using Combinatorica. Needs["DiscreteMath`Combinatorica`"] am = {{0, 0, 1, 0, 0, 1, 1}, {0, 0, 0, 0, 1, 1, 1}, {1, 0, 0, 1, 1, 1, 1}, {0, 0, 1, 0, 1, 0, 1}, {0, 1, 1, 1, 0, 1, 0}, {1, 1, 1, 0, 1, 0, 0}, {1, 1, 1, 1, 0, 0, 0}}; MatrixForm[am] (* Your Labels here as a list *) Lbls = CharacterRange["A", "G"]; g = SetVertexLabels[FromAdjacencyMatrix[am], Lbls]; ShowGraph[g]; -- HTH :>) Dana DeLouis Windows XP & Mathematica 5.2 <alexxx.magni(a)gmail.com> wrote in message news:ett7ks$id6$1(a)smc.vnet.net... > greetings, > after having used for some time a very powerful program (Graphviz) for > displaying the graph structures I'm working on, I decided to give it a > try under Mathematica, since I use M. for many other related tasks. > > I started from DiscreteMath`GraphPlot`, but from what I can see > everything is done using an adjacency matrix composed of (0,1)'s, > right? > That is, my problem is that I need to LABEL the vertices with a name, > instead of a position. >>From >>http://documents.wolfram.com/mathematica/functions/AdvancedDocumentati >>onGraphPlot > I thought for a moment it was possible (e.g. see graph under > "MaximalBipartiteMatching" with Tom,Rob,Adam etc), but I then realized > it was demonstration-only, and no code is present to do it > > am I right, or there is a way? > > thanks for any help... > > Alessandro Magni
From: alexxx.magni on 7 Apr 2007 04:13
This one I really like, it is sort of like "automatic" as I wanted it to be. thank you everybody! Alessandro On 6 Apr, 10:51, "Dana DeLouis" <dana....(a)gmail.com> wrote: > > ..everything is done using an adjacency matrix composed of (0,1)'s > > If you are working with an AdjacencyMatrix, here's an additional idea using > Combinatorica. > > Needs["DiscreteMath`Combinatorica`"] > > am = {{0, 0, 1, 0, 0, 1, 1}, > {0, 0, 0, 0, 1, 1, 1}, > {1, 0, 0, 1, 1, 1, 1}, > {0, 0, 1, 0, 1, 0, 1}, > {0, 1, 1, 1, 0, 1, 0}, > {1, 1, 1, 0, 1, 0, 0}, > {1, 1, 1, 1, 0, 0, 0}}; > > MatrixForm[am] > > (* Your Labels here as a list *) > Lbls = CharacterRange["A", "G"]; > > g = SetVertexLabels[FromAdjacencyMatrix[am], Lbls]; > > ShowGraph[g]; > > -- > HTH :>) > Dana DeLouis > Windows XP & Mathematica 5.2 > > <alexxx.ma...(a)gmail.com> wrote in messagenews:ett7ks$id6$1(a)smc.vnet.net... > > greetings, > > after having used for some time a very powerful program (Graphviz) for > > displaying the graph structures I'm working on, I decided to give it a > > try under Mathematica, since I use M. for many other related tasks. > > > I started from DiscreteMath`GraphPlot`, but from what I can see > > everything is done using an adjacency matrix composed of (0,1)'s, > > right? > > That is, my problem is that I need to LABEL the vertices with a name, > > instead of a position. > >>From > >>http://documents.wolfram.com/mathematica/functions/AdvancedDocumentati > >>onGraphPlot > > I thought for a moment it was possible (e.g. see graph under > > "MaximalBipartiteMatching" with Tom,Rob,Adam etc), but I then realized > > it was demonstration-only, and no code is present to do it > > > am I right, or there is a way? > > > thanks for any help... > > >Alessandro Magni |