Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: graph

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125354] Re: graph
  • From: Adriano Pascoletti <adriano.pascoletti at uniud.it>
  • Date: Fri, 9 Mar 2012 06:07:12 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201203080940.EAA14251@smc.vnet.net>

Generate the directed graph


gr = Graph[Join @@ (Thread[DirectedEdge @@ #1] & ) /@ {{1, {11, 6, 13,
22}},
           {2, {35, 10, 12, 8, 28}}, {3, {23, 31, 19, 14, 11}},
           {4, {9, 15, 7, 13, 33, 19}}, {5, {28, 8, 32, 34}}, {6, {27, 13,
1,
       11, 20}},
           {7, {13, 4, 15, 17, 21, 32, 8}}, {8, {7, 32, 5, 28, 2, 12}}}]


then evaluate


AdjacencyMatrix[gr]  or Normal@AdjacencyMatrix[gr].


Adriano Pascoletti


2012/3/8 clansa <dauphinester at gmail.com>

> I have this kind of data
> {{1, {11, 6, 13, 22}}, {2, {35, 10, 12, 8, 28}}, {3, {23, 31, 19, 14,
>   11}}, {4, {9, 15, 7, 13, 33, 19}}, {5, {28, 8, 32, 34}}, {6, {27,
>   13, 1, 11, 20}}, {7, {13, 4, 15, 17, 21, 32, 8}}, {8, {7, 32, 5,
>   28, 2, 12}}}
> The node 1 is connected to nodes 11, 6, 13 and 22
> the node 2 is connected to nodes 35,10,12,8 and 28
>
> I want to make a graph gr
> and then to obtain adjency matrix with AdjacencyMatrix[gr]
>
> I work with many nodes (>250
>
> Thanks
> Andrew
>
>


  • References:
    • graph
      • From: clansa <dauphinester@gmail.com>
  • Prev by Date: CUDAFunctionLoad problem
  • Next by Date: Re: much power to mathematica
  • Previous by thread: graph
  • Next by thread: Re: graph