igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] igraph-help Digest, Vol 95, Issue 6


From: 李甜
Subject: Re: [igraph] igraph-help Digest, Vol 95, Issue 6
Date: Mon, 9 Jun 2014 19:24:58 +0800

The version I was using is igraph-0.6.5-msvc. I used two layout funcitons from layout.c,the first one is  igraph_layout_random(const igraph_t *graph, igraph_matrix_t *res),and the second one is igraph_layout_fruchterman_reingold(const igraph_t *graph, igraph_matrix_t *res,
      igraph_integer_t niter, igraph_real_t maxdelta,
      igraph_real_t area, igraph_real_t coolexp, 
      igraph_real_t repulserad, igraph_bool_t use_seed,
      const igraph_vector_t *weight, 
      const igraph_vector_t *minx,
      const igraph_vector_t *maxx,
      const igraph_vector_t *miny,
      const igraph_vector_t *maxy).
The specific process is as follows:
#include<stdio.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <igraph.h>
using namespace std;
int main()
{
    vector<int> X;//store X coordinate
    vector<int> Y;//store Y coordinate
    char *filepath="E:\\ltt\\dataset\\betweeness.csv";
    igraph_t g;
    FILE *input;
    igraph_integer_t N,Ne,Maxdegree;
    input=fopen(filepath,"r");
    igraph_read_graph_edgelist(&g, input, 0, 0);
    fclose(input);
    N=igraph_vcount(&g);//number of vertex
    Ne=igraph_ecount(&g);//number of edge
 
    igraph_matrix_t res_1;
   igraph_matrix_init(&res_1,N,2);
    ///Set the parameters as the discription
    igraph_integer_t niter=500;
    igraph_real_t maxdelta=N;
    igraph_real_t area=N*N;
    igraph_real_t coolexp=1.5;
    igraph_real_t repulserad=N*N*N;
    igraph_bool_t use_seed=false;
    igraph_vector_t weight; 
    igraph_vector_t minx;
    igraph_vector_t maxx;
    igraph_vector_t miny;
    igraph_vector_t maxy;

    igraph_vector_init(&weight,Ne);
    igraph_vector_init(&minx,N);
    igraph_vector_init(&maxx,N);
    igraph_vector_init(&miny,N);
    igraph_vector_init(&maxy,N);
    igraph_vector_init(&maxy,N);
    igraph_vector_init(&maxy,N);
    //igraph_layout_random(&g,&res_1);
 igraph_layout_fruchterman_reingold(&g,&res_1,niter,maxdelta,area,coolexp,repulserad,use_seed,&weight,&minx,&maxx,&miny,&maxy);
    int s=igraph_matrix_nrow(&res_1);
    for(int i=0;i<s;i++)
    {
   X.push_back(MATRIX(res_1,i,0));
   Y.push_back(MATRIX(res_1,i,1));
    }
    for(int i=0;i<X.size();i++)
    {
         cout<<"x"<<i<<"="<<X[i]<<","<<"y"<<i<<"="<<Y[i]<<endl;
     }
igraph_matrix_destroy(&res_1);
}
and the execution result is like this:
x0=0,y0=0
x1=0,y1=0
x2=0,y2=0
x3=0,y3=0
x4=0,y4=0
x5=0,y5=0
x6=0,y6=0
x7=0,y7=0
x8=0,y8=0
x9=0,y9=0
x10=0,y10=0
x11=0,y11=0
x12=0,y12=0
x13=0,y13=0
x14=0,y14=0
x15=0,y15=0
x16=0,y16=0
x17=0,y17=0
x18=0,y18=0
No matter whether I used the "igraph_layout_random()" or the "igraph_layout_fruchterman_reingold()",the results are both as mentioned above.It means that the X cooridnate and the Y coordinate in the matrix res_1 is zero,.So it can't layout the graph. I don't know why and  what's wrong with it .
Hope for your help .Thank you! 

                                                                                                                                                   Tian Li


2014-06-09 0:00 GMT+08:00 <address@hidden>:
Send igraph-help mailing list submissions to
        address@hidden

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.nongnu.org/mailman/listinfo/igraph-help
or, via email, send a message with subject or body 'help' to
        address@hidden

You can reach the person managing the list at
        address@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of igraph-help digest..."


Today's Topics:

   1. Problems about igraph-c library generating layouts for    graph (??)
   2. Re: Problems about igraph-c library generating layouts for
      graph (G?bor Cs?rdi)
   3. igraph_haplotype network_vertex.shape = "pie"_problem (Axel Hille)


----------------------------------------------------------------------

Message: 1
Date: Sat, 7 Jun 2014 23:40:49 +0800
From: ?? <address@hidden>
To: address@hidden
Subject: [igraph] Problems about igraph-c library generating layouts
        for     graph
Message-ID:
        <address@hidden>
Content-Type: text/plain; charset="utf-8"

Hello:
 I found some problems when I used the igraph-c library generating layouts
for graph.When I used the igraph-layout-random and the
igraph-layout-frucherman-
reingold the matrix object which contains the result is zero.It cann't
layout the graph.I don't know why,so I want to ask about it.
 I'm looking forward to your reply.Best regards.





                Tian Li
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nongnu.org/archive/html/igraph-help/attachments/20140607/be5dde53/attachment.html>

------------------------------

Message: 2
Date: Sat, 7 Jun 2014 12:54:24 -0400
From: G?bor Cs?rdi <address@hidden>
To: Help for igraph users <address@hidden>
Subject: Re: [igraph] Problems about igraph-c library generating
        layouts for     graph
Message-ID:
        <CABtg=KnF3ft398q45CB3vZ4Kmh=address@hidden>
Content-Type: text/plain; charset=UTF-8

Most probably you are doing something wrong. We cannot tell you what,
because you did not tell us what you did.

Gabor

On Sat, Jun 7, 2014 at 11:40 AM, ?? <address@hidden> wrote:
> Hello:
>  I found some problems when I used the igraph-c library generating layouts
> for graph.When I used the igraph-layout-random and the
> igraph-layout-frucherman-
> reingold the matrix object which contains the result is zero.It cann't
> layout the graph.I don't know why,so I want to ask about it.
>  I'm looking forward to your reply.Best regards.
>
>
>
>
>
> Tian Li
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>



------------------------------

Message: 3
Date: Sat, 7 Jun 2014 22:53:45 +0200
From: "Axel Hille" <address@hidden>
To: address@hidden
Subject: [igraph] igraph_haplotype network_vertex.shape =
        "pie"_problem
Message-ID:
        <address@hidden>

Content-Type: text/plain; charset="us-ascii"

An HTML attachment was scrubbed...
URL: <http://lists.nongnu.org/archive/html/igraph-help/attachments/20140607/e8d883fd/attachment.html>

------------------------------

_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help


End of igraph-help Digest, Vol 95, Issue 6
******************************************


reply via email to

[Prev in Thread] Current Thread [Next in Thread]