creating adjacency matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg36561] creating adjacency matrices
- From: "Moliterno, Thomas" <TMoliter at gsm.uci.edu>
- Date: Wed, 11 Sep 2002 13:27:52 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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. Tom ********************************************** Thomas P. Moliterno Graduate School of Management University of California, Irvine tmoliter at uci.edu **********************************************