MathGroup Archive 2002

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

Search the Archive

creating adjacency matrices

  • To: mathgroup at
  • Subject: [mg36561] creating adjacency matrices
  • From: "Moliterno, Thomas" <TMoliter at>
  • Date: Wed, 11 Sep 2002 13:27:52 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

I need to create an adjacency matrix from my data, which is currently in
the form of a .txt file and is basically a two column incidence list.
For example: 

1 A 
1 B 
2 B 
3 C 
. . 
. . 
. . 
m n 

Where 1 to m represent actors and A to n represent events. My goal is to
have an (m x m) matrix where cell i,j equals 1 if two actors are
incident to the same event (in the sample above, 1 and 2 are both
incident to B) and 0 otherwise (w/ zeros on the diagonal). 

I'm new to Mathmatica, and so I'm on the steep part of the learning
curve ... All I've been able to figure out so far is how to get my
incidence list into the program using Import["filename.txt"]. But then
what? How do I convert to the adjacency matrix? I've found the
ToAdjacencyMatrix[] command in DiscreteMath`Combinatorica`, but I can't
seem to get it to work ... 

Thanks to any and all in advance. 


Thomas P. Moliterno
Graduate School of Management
University of California, Irvine
tmoliter at

  • Prev by Date: Uneven FrameTicks with ExtendGraphics
  • Next by Date: Re: X(NumLock)=Mod2 (was Re: Profiler for Mathematica)
  • Previous by thread: RE: Uneven FrameTicks with ExtendGraphics
  • Next by thread: Re: creating adjacency matrices