Questions tagged [adjacency-matrix]

A means of representing which vertices (or nodes) of a graph are adjacent to which other vertices.

The adjacency matrix of a finite graph G on n vertices is the n×n matrix where the non-diagonal entry aij is the number of edges from vertex i to vertex j, and the diagonal entry aii, depending on the convention, is either once or twice the number of edges (loops) from vertex i to itself.

Undirected graphs often use the latter convention of counting loops twice, whereas directed graphs typically use the former convention.
There exists a unique adjacency matrix for each isomorphism class of graphs (up to permuting rows and columns), and it is not the adjacency matrix of any other isomorphism class of graphs.
In the special case of a finite simple graph, the adjacency matrix is a (0,1)-matrix with zeros on its diagonal.

If the graph is undirected, the adjacency matrix is symmetric.

The relationship between a graph and the eigenvalues and eigenvectors of its adjacency matrix is studied in spectral graph theory.

http://en.wikipedia.org/wiki/Adjacency_matrix

900 questions
0
votes
2 answers

Will SCC pattern change if we reverse a graph(using Kosaraju's Algorithm)?

Assume we have a digraph, it is not a complete graph and has more than one SCC. I wonder if the patterns of Strongly Connected Component changes if we transpose the graph and use Kosaraju's Algorithm? By saying "transpose the graph" I mean flip the…
0
votes
1 answer

What is a fast matrix or two-dimensional array to store an adjacency matrix in C++

I'm trying to infer a Markov chain of a process I can only simulate. The amount of states/vertices that the final graph will contain is very large, but I do not know the amount of vertices in advance. Right now I have the following: My simulation…
jlmr
  • 165
  • 10
0
votes
2 answers

R: How to get something like adjacency matrix, but on the intersection value of third column?

I have data frame like this: V1 V2 LABEL 1 83965 891552 A 2 88599 891552 B 3 42966 891552 C 4 83965 891553 D 5 88599 891553 D 6 42966 891553 B How can I convert it to something like adjacency…
andilabs
  • 22,159
  • 14
  • 114
  • 151
0
votes
3 answers

MATLAB: Finding the number of unique successors of each node from a matrix

I'm new to the MATLAB software and am currently trying to learn it without being formally taught and have a pretty simple question. I have an adjacency matrix that corresponds to a digraph and want to see what nodes are connected by a walk to other…
Owen
  • 13
  • 6
0
votes
2 answers

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 at AdjMatrixDigraph.main(AdjMatrixDigraph.java:90)

In my code I am trying to derive an adjacency matrix, but I'm getting the following exception. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 at…
0
votes
3 answers

Matrix addition using triples representation in Python

I'd like to know how I can do matrix addition in Python, and I'm running into quite a number of roadblocks trying to figure out the best way. Here's the problem, written as best as I can formulate it right now. I have a data set, which is an…
ericmjl
  • 13,541
  • 12
  • 51
  • 80
0
votes
1 answer

Tracing paths in a Graph between two nodes

How to trace the paths between two nodes in a given graph once if we know or donot know the length of the path between them?( By considering Adjacency matrix) Between Adjacency matrix and breadth first search in finding the paths which one is…
0
votes
1 answer

Adjacent matrix

How can I combine these two functions to create a program that will allow a user to enter the count of vertices and then enter the graph edges? #include using namespace std; int **malloc2d(int r, int c) { int **t = new int*[r]; …
Nick
  • 1,036
  • 2
  • 14
  • 27
0
votes
1 answer

Matlab dijkstra shortest path: list of nodes

I would be really glad if you could suggest me a Matlab library containing functions that will allow me to list: 1) all paths from a source to dest node on a network identified by its adjacency matrix 2) when applying dijkstra algorithm, I want to…
0
votes
1 answer

Pathfinding in adjacency matrix

Given an adjacency matrix, how would you find the shortest paths between two nodes while traversing to each point at least once and returning how many moves it takes? Example Given this array int[][] points = { { 0, 1 },{ 0, 2 },{ 1, 2 },{ 1, 3 },{…
mjenkins2010
  • 51
  • 2
  • 9
0
votes
2 answers

Adjacency Matrix -> Directed graph -> DFS

This is the code my friends and I have come up with so far after fiddling around. What we are trying to do is read in the adjacency matrix (input.txt), then create a directed graph out of it so we can search it using Depth-First Search. We want the…
0
votes
1 answer

Keeping edge values in graph after converting it to a network object in R

Note 1: I'm using the R packages "network" and "sna" Note 2: My original data are in edgelist format in a .csv file. I've been looking for the best way to read in edgelist data into R. At first sight, this is simple. data <- read.csv("file.CSV",…
0
votes
1 answer

how does one predict edges / links / connections on a weighted directed graph network?

Given an adjacency matrix A for a weighted, directed graph (so matrix elements are not just 0/1 and the matrix is not symmetric), are there any good methods for predicting new edges? I have a VERY large (billions of nodes) dataset with known edges…
Glenn Strycker
  • 4,816
  • 6
  • 31
  • 51
0
votes
1 answer

Adjacency matrix for boggle board

I'd like to generate the adjacency matrix for a boggle board. A boggle board is one where you have alphabets in a nxn matrix like this: http://www.wordtwist.org/sample.gif Each cell is connected to its neighbor cell; basically we move…
codewarrior
  • 984
  • 4
  • 18
  • 34
0
votes
1 answer

Drawing a line between points in a file

I need to draw lines between in java from a file that is formatted the following way: 5 //Number of lines of points 10 10 23 56 15 34 32 67 76 45 I think I am going to have to set up two arrays and then somehow add the values like that…
JLott
  • 1,818
  • 3
  • 35
  • 56