GraphStream Users

Archives de la liste Aide


Re: Adjacency Matrix


Chronologique Discussions 
  • From: Suhas Bhairav <suhasbhairav AT gmail.com>
  • To: Yoann Pigné <yoann.pigne AT gmail.com>
  • Cc: "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>
  • Subject: Re: Adjacency Matrix
  • Date: Thu, 11 Aug 2016 10:49:29 +0200

Hi,

Thank you!

Regards
Suhas Bhairav

On 11 August 2016 at 10:47, Yoann Pigné <yoann.pigne AT gmail.com> wrote:
Hi,

You can access graphs’ nodes with indices, so it becomes trivial to create a graph from such matrix or create a matrix from a graph.

From the the "Getting Started" tutorial (first link in google when looking for « graphstream adjacency matrix ») :

int n = graph.getNodeCount();
byte adjacencyMatrix[][] = new byte[n][n];
for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
                adjacencyMatrix[i][j] = graph.getNode(i).hasEdgeBetween(j) ? 1 : 0;


Yoann

> On Aug 11, 2016, at 10:18 AM, Suhas Bhairav <suhasbhairav AT gmail.com> wrote:
>
> Hi All,
>
> Is there an adjacency matrix feature in graphstream with respect to graphs?
>
> Regards
> Suhas Bhairav





Archives gérées par MHonArc 2.6.16.

Top of page