[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Help!!!!!!!!! how to get the laplacian of undirected weight
From: |
Gabor Csardi |
Subject: |
Re: [igraph] Help!!!!!!!!! how to get the laplacian of undirected weighted graph? |
Date: |
Thu, 25 Sep 2008 09:55:30 +0200 |
User-agent: |
Mutt/1.5.11 |
I've never seen the definition of the Laplacian of a weighted graph,
but if it is the obvious generalization, then it should be something
like:
weighted.laplacian <- function(g) {
adj <- get.adjacency(g, attr="weight")
deg <- apply(adj, 1, sum)
diag(deg) - adj
}
# Some quick test
g <- ba.game(10, directed=FALSE)
E(g)$weight <- sample(1:3, ecount(g), replace=TRUE)
weighted.laplacian(g)
It does not handle loop edges and I am not sure what it does
if you have multiple edges, but if you have a simple graph, then
it should be OK. The graph must have an edge attribute called 'weight'.
Is this what you want? If not, then could you point me to the
definition of the Laplacian of a weighted graph?
Gabor
On Wed, Sep 24, 2008 at 09:57:42AM -0500, lan gao wrote:
> Hello, guys,
> Does anyone know how to get the laplacian matrix of an undirected
> and weighted graph?
> I know for a simple undirected graph , we can use
> graph.laplacian(g) to get it, but I need to add weight to each edge, then
> how to get the laolacian of a weighted graph?
> Can I add weight to the attribute of edge like E(g)$ weight<- wt ,
> then
> get adjacency matrix first....I am lost...
> Can anyone give me a clue?
> Many thanks.
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help