|
Posted by Luuk on 01/19/08 19:29
"itschy" <google@00l.de> schreef in bericht
news:2ff63e42-9e07-44cf-8c84-98ecfd2a9f22@s12g2000prg.googlegroups.com...
> On 19 Jan., 19:47, "Luuk" <l...@invalid.lan> wrote:
>> "itschy" <goo...@00l.de> schreef in
>> berichtnews:f3021843-6e89-4177-aaf1-078582ec9197@i7g2000prf.googlegroups.com...
>>
>>
>>
>> > On 19 Jan., 19:08, "Luuk" <l...@invalid.lan> wrote:
>> >> "itschy" <goo...@00l.de> schreef in
>> >> berichtnews:58f6331e-c13b-4226-a64c-9f7bc1ea8726@v67g2000hse.googlegroups.com...
>>
>> >> > On 18 Jan., 23:31, Jensen Somers <jensen.som...@gmail.com> wrote:
>> >> >> PHP has support to create images, so my guess is - if I understand
>> >> >> the
>> >> >> problem correctly - you'll just need to find a way to draw dots and
>> >> >> lines, making them thicker depending on the weight they have.
>>
>> >> > Not quite.
>> >> > You missed the part, where I mentiond that I do not have any
>> >> > coordinates of the nodes. Thus I'cant just draw them, cause I don't
>> >> > know where. :)
>> >> > What I seek is some solution, which finds a representation according
>> >> > to the information I have about the edges (that is, connected or
>> >> > not,
>> >> > and if, what weight/line length do they have).
>>
>> >> > E.g.:
>> >> > I have three nodes A,B,C and 3 connections a(A,B,3), b(B,C,4),
>> >> > c(A,C,
>> >> > 5) (each with infos about from_node, to_node and weight/length.
>> >> > In this szenario, there are only two possible ways to draw that
>> >> > network correctly:
>> >> > 5
>> >> > A-----C B
>> >> > 3\ /4 3/ \4
>> >> > B A-----C
>> >> > 5
>>
>> >> > And their rotations.
>> >> > I try to find some tool/algorithm which is able to do this (and draw
>> >> > it) in php.
>> >> > Tough luck I guess... :(
>>
>> >> > itschy
>>
>> >> aaah, you mean something
>> >> like:http://www.graphviz.org/Gallery/directed/hello.html
>> >> this is a sample with nodes 'hello' and 'world'
>> >> but this sollution does not give you weight...
>> >> (see also:http://www.graphviz.org/webdot/basic.html)
>>
>> >> and, of course, this is not a PHP solution...
>>
>> > Thanks for your answer.
>> > I know the dot package, actually wrote my master thesis using it, but
>> > as you said, its not a php solution. :(
>>
>> > To anticipate the next answer in this thread: I know about cgi etc,
>> > but I do not have any rights on the server this is supposed to run, so
>> > i search a PURE php solution.
>>
>> as you know the stuff.....
>>
>> and you know php.net
>>
>> it took me 5 mins to create this:
>> <?php
>> header("Content-type: image/png");
>> $im = @imagecreate(110, 120)
>> or die("Cannot Initialize new GD image stream");
>> $background_color = imagecolorallocate($im, 0, 0, 0);
>> $text_color = imagecolorallocate($im, 233, 14, 91);
>> //imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
>> imageline($im, 10,10, 100, 10, $text_color);
>> imageline($im, 10,10, 50, 110, $text_color);
>> imageline($im, 100,10, 50, 110, $text_color);
>> imagepng($im);
>> imagedestroy($im);
>> ?>
>>
>> which is a nice triangular... ;-)
>> (thanks to the docs..!!!)
>>
>> i whish you suc6..
>
> Luuk, please explain to me how you do that without ANY explicit
> coordinates, like 10,10,100,10!
> Please, everybody, READ what I write! cheers
you dont need to know,
as 'the philosopher' said: "To plot it, simply assume one point (A) is at
0,0"
or, as i did, asume its at (10,10)
you can posistion the second node anywhere YOU like, so in my example (100,
10)
and when the third node is mention, you have to calculate where you should
put this node...(based on you knowledge)
[[knowledge of itschy: I have three nodes A,B,C and 3 connections a(A,B,3),
b(B,C,4), c(A,C,> 5) ]]
and i think i did READ what you WROTE, but i dont think you UNDERSTAND what
you ASK ??
;-)
[Back to original message]
|