Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8933
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: graph |
| Date | 2012-03-09 11:09 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jjcodt$q7r$1@smc.vnet.net> (permalink) |
| References | <201203080940.EAA14251@smc.vnet.net> |
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}}};
adjMatrix = With[{m = Max[data]},
SparseArray[
Join @@
(Thread[Thread[{#[[1]], #[[2]]}] -> 1] & /@ data),
{m, m}]];
adjGraph = AdjacencyGraph[adjMatrix,
VertexLabels -> "Name", ImageSize -> 600]
Bob Hanlon
On Thu, Mar 8, 2012 at 4:40 AM, clansa <dauphinester@gmail.com> wrote:
> 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
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: graph Bob Hanlon <hanlonr357@gmail.com> - 2012-03-09 11:09 +0000
csiph-web