Re: VertexStyle determined by List elements
- To: mathgroup at smc.vnet.net
- Subject: [mg54228] Re: [mg54135] VertexStyle determined by List elements
- From: Henning Heiberg-Andersen <Henning.Heiberg-Andersen at fi.uib.no>
- Date: Sun, 13 Feb 2005 22:17:17 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
During the time it took for my request to pass the queue I had time to
explore the faboluos capabilities of Mathematica, so here is a small
routine for plotting the values of eigenvector number m at the n
vertices of the graph g:
vec=Extract[N[Eigenvalues[SparseArray[ToAdjacencyMatrix[g]]]],m];
AssignColor[x_]:=If[x>0,Blue,Brown];
AssignDisk[x_,scale_]:={x,VertexColor->AssignColor[Extract[vec,x],
VertexStyle->Disk[Abs[vec,x]/scale]}
ScaleVertices[scale_]:=Table[AssignDisk[x,scale],{x,1,n}]
Now the m'th eigenvector will be visualized by typing:
ShowGraph[SetGraphOptions[g,ScaleVertices[15]]
(when 'scale' is chosen equal to 15).
Best regards,
Henning Heiberg-Andersen
On Fri, 11 Feb 2005, Chris Chiasson wrote:
> Is the list of fixed or variable length? What is the function you
> would like to use to permute the parameter going to the Disk function?
>
>
> On Fri, 11 Feb 2005 03:34:01 -0500 (EST), Henning Heiberg-Andersen
> <Henning.Heiberg-Andersen at fi.uib.no> wrote:
> >
> > Hi,
> >
> > I have generated some large graphs with the Combinatorica Package,
> > and have a large List of different variables I would like to apply in the
> > VertexStyle command.
> >
> > More specific, how can I get from typing by hand
> >
> > SetGraphOptions[graph,{1,VertexStyle->Disk[var1]},
> > {2,VertexStyle->Disk[var2]},...
> > ...{N,VertexStyle->Disk[varN]}]
> >
> > to a more sensible solution?
> >
> > Best regards,
> >
> > Henning Heiberg-Andersen
> >
> >
>
>
>