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 7


From: Gábor Csárdi
Subject: Re: [igraph] igraph-help Digest, Vol 95, Issue 7
Date: Tue, 10 Jun 2014 10:37:58 -0400

Well, then please send the code that uses igraph_layout_random().
Maybe you called another layout algorithm after calling
igraph_layout_random().

A null pointer is NULL or simply 0. E.g.
https://github.com/igraph/igraph/blob/master/examples/simple/igraph_layout_reingold_tilford.c#L37

Gabor

On Tue, Jun 10, 2014 at 10:34 AM, 李甜 <address@hidden> wrote:
> Thank for your reply,but I still have two problems:
> first,when I used the function igraph_layout_random(const igraph_t *graph,
> igraph_matrix_t *res),the execution result was also as mentioned above.It
> can't layout the graph either,so I want to know why it is like this?
> second,I have read a part of  igraph-docs But it seems that I don't know how
> to pass a null pointer.Is it like this?
> igraph_vector_init(&minx,N);
> igraph_vector_null(&minx);
> Hope for your reply.
> Thank you .
> Best regards!
>
> Tian Li
>
>
>
> 2014-06-10 0:01 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. Re: igraph-help Digest, Vol 95, Issue 6 (??)
>>    2. Re: igraph-help Digest, Vol 95, Issue 6 (G?bor Cs?rdi)
>>    3. Estimation of the average distance (Vincent Labatut)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Mon, 9 Jun 2014 19:24:58 +0800
>> From: ?? <address@hidden>
>> To: address@hidden
>> Subject: Re: [igraph] igraph-help Digest, Vol 95, Issue 6
>> Message-ID:
>>
>> <address@hidden>
>> Content-Type: text/plain; charset="utf-8"
>>
>> 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
>> > ******************************************
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> <http://lists.nongnu.org/archive/html/igraph-help/attachments/20140609/ea8dc612/attachment.html>
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Mon, 9 Jun 2014 09:06:52 -0400
>> From: G?bor Cs?rdi <address@hidden>
>> To: Help for igraph users <address@hidden>
>> Subject: Re: [igraph] igraph-help Digest, Vol 95, Issue 6
>> Message-ID:
>>
>> <address@hidden>
>> Content-Type: text/plain; charset=UTF-8
>>
>> Hi,
>>
>> you pass minx, maxx, miny and maxy and they contain zeros, so you
>> restrict the layout to [0,0] x [0,0]. Pass a null pointer for these
>> arguments if you don't want to restrict the coordinates.
>>
>> You are also passing in a fully zero weight matrix, you probably want
>> to use a null pointer here as well.
>>
>> Btw. you are using an old version of igraph, the latest version of the
>> C library is 0.7.1.
>>
>> Gabor
>>
>> On Mon, Jun 9, 2014 at 7:24 AM, ?? <address@hidden> wrote:
>> > 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:
>> >>
>> >> <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
>> >> ******************************************
>> >
>> >
>> >
>> > _______________________________________________
>> > igraph-help mailing list
>> > address@hidden
>> > https://lists.nongnu.org/mailman/listinfo/igraph-help
>> >
>>
>>
>>
>> ------------------------------
>>
>> Message: 3
>> Date: Mon, 9 Jun 2014 18:37:15 +0300
>> From: Vincent Labatut <address@hidden>
>> To: Help for igraph users <address@hidden>
>> Subject: [igraph] Estimation of the average distance
>> Message-ID:
>>
>> <address@hidden>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Hello,
>>
>> I want to process the average distance of some large graphs. I do not need
>> the paths themselves, or the individual lengths of all possible shortest
>> paths, but just the average value over the whole graph.
>>
>> However, when using the function average.path.length() (R version of
>> igraph), it takes too long (weeks) due to the size of the graphs. I could
>> do with only an estimation of the average distance, so I was wondering if
>> there was any way of processing such an approximation (I noticed some
>> functions such as betweenness() have an 'estimate' version).
>>
>> Best regards,
>> Vincent
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> <http://lists.nongnu.org/archive/html/igraph-help/attachments/20140609/4b5eb08d/attachment.html>
>>
>> ------------------------------
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
>> End of igraph-help Digest, Vol 95, Issue 7
>> ******************************************
>
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>



reply via email to

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