Questions tagged [adjacency-matrix]

36 questions
23
votes
3 answers

When are adjacency lists or matrices the better choice?

I was told that we would use a list if the graph is sparse and a matrix if the graph is dense. For me, it's just a raw definition. I don't see much beyond it. Can you clarify when would it be the natural choice to make? Thanks in advance!
user21312
  • 351
  • 1
  • 2
  • 4
15
votes
3 answers

Intuition behind eigenvalues of an adjacency matrix

I am currently working to understand the use of the Cheeger bound and of Cheeger's inequality, and their use for spectral partitioning, conductance, expansion, etc, but I still struggle to have a start of an intuition regarding the second eigenvalue…
m.raynal
  • 369
  • 1
  • 2
  • 11
11
votes
0 answers

Min-eigenvalue bound for a random d-regular graph

I need help proving the following fact: Let $G$ be a random $d$-regular graph with adjacency matrix $A$. The smallest eigenvalue $\lambda_n$ of $A$ should satisfy $|\lambda_n| = o_d(d)$. (In particular, I think $|\lambda_n| = O(\sqrt{d})$.) Exercise…
Sam
  • 156
  • 6
7
votes
2 answers

What is the complexity of this matrix transposition?

I'm working on some exercises regarding graph theory and complexity. Now I'm asked to give an algorithm that computes a transposed graph of $G$, $G^T$ given the adjacency matrix of $G$. So basically I just have to give an algorithm to transpose an…
4
votes
1 answer

Determining if a digraph has any vertex-disjoint cycle cover

Given a digraph, determine if the graph has any vertex-disjoint cycle cover. I understand that the permanent of the adjacency matrix will give me the number of cycle covers for the graph, which is 0 if there are no cycle covers. But is it possible…
Shadow
  • 43
  • 3
4
votes
1 answer

SimRank on a weighted directed graph (how to calculate node similarity)

I have a weighted directed graph (it's sparse, 35,000 nodes and 19 million edges) and would like to calculate similarity scores for pairs of nodes. SimRank would be ideal for this purpose, except that it applies to unweighted graphs. It's easy to…
Remy
  • 181
  • 1
  • 7
4
votes
2 answers

How to represent BFS and DFS between adjacency matrix and list?

I'm trying to figure out how to best represent BFS (Breadth First Search) and DFS (Depth First Search) on a graph, specifically between being represented as an adjacency matrix and an adjacency list. How do I determine which is a better…
3
votes
1 answer

Eigenvalue computation for large graph

Consider a large graph, minimum 1 000 vertices but it can easily go up to 50 000 vertices depending the case. The graph is the result of social relationships (followers, following, friendship) so it can be oriented but for the ease of the solution…
3
votes
0 answers

When are adjacency lists better than sparse matrices?

I saw several questions discussion the benefits of adjacency lists over matrices to represent a sparse undirected graph. On the other hand, none of them discuss sparse matrix representations such as scipy's coo or csr formats. Do adjacency lists…
3
votes
1 answer

Calculate boolean matrix multiplication (BMM) using transitive closure

Let us say I am given an algorithm that calculates the transitive closure of a given graph $G = \{ V, E \}$. How can I use this algorithm in order to perform the Boolean Matrix Multiplication of two matrices $X$ and $Y$? I know that in order to…
2
votes
0 answers

Eigenvalues of an induced subgraph of a random graph

Suppose $G$ is a random graph on $n$ vertices where each edge appears with probability half. Suppose someone looks at the resulting graph and chooses an arbitrary subset $W$ of vertices of size $k>\sqrt{n}$. How do the eigenvalues of the induced…
chyle
  • 464
  • 3
  • 10
2
votes
1 answer

Adjacency matrix and recognizing hierarchy?

I'm currently learning about graphs and I have some questions regarding adjacency matrices. Given an arbitrary adjacency matrix: Is there any way to tell if that matrix represents a hierarchal graph structure? Obviously in the above case it's not.…
ocean800
  • 125
  • 4
2
votes
1 answer

Remove Edge From Adjacency List

INPUT: weighted undirected graph in the form of adjacency list OUTPUT: adjacency list without the edge e Naive approach is: for(int i = 0; i < adj.get(e.s).size(); i++) { // loop through adjacent of s if(adj.get(e.s).get(i).v == e.t) { …
iluvAS
  • 233
  • 2
  • 5
2
votes
1 answer

How to generate random adjacency matrix with given number of components in graph

I am building a graph package in C and a part of the work involves generating a random graph with a given number of components in the graph. For example, if I wanted to generate a graph of 50 vertices and 5 components, then the module will take 50…
1
vote
2 answers

Time complexity of Prim's algorithm

There is this Prim's algorithm I am studying, the time complexity of which is $O(n^2)$ (in the adjacency matrix). As far as I have understood,that is because we have to ckeck all the nodes per every node, that is, when checking the first node's best…
1
2 3