Coder Social home page Coder Social logo

kklayout's Introduction

This is a php version implemention of the Kamada-Kawai algorithm for force directed graph layout.
Does not respect filter calls, and sometimes crashes when the view changes to it.

see "Tomihisa Kamada and Satoru Kawai: An algorithm for drawing general indirect graphs. Information Processing Letters 31(1):7-15, 1989" 
see "Tomihisa Kamada: On visualization of abstract objects and relations. Ph.D. dissertation, Dept. of Information Science, Univ. of Tokyo, Dec. 1988."

author ggsonic

*the getDistance function needs to be hacked. For now, it is just a very simple strategy to get the weight of distance

code sample to use:
<?php

$nodes = array();

/* Create 11 random nodes */ 
for($i=0;$i<=10;$i++)
{
    $Connections = ""; $RandCx1 = rand(0,1);
    for($j=0;$j<=$RandCx1;$j++)
    {
        $RandCx2 = rand(0,10);
        if ( $RandCx2 != $j )
        { $Connections[] = $RandCx2; }
    }
    $nodes[$i] = array('idx' => $i, "conn" => $Connections);
}
$kklayout = new KKLayout ( $nodes );
$kklayout->initialize ();
while ( ! $kklayout->done () ) {
    $kklayout->step ();
}
//var_dump($kklayout->xydata);exit;
?>

kklayout's People

Contributors

ggsonic avatar

Stargazers

Özer Yenihayat avatar Márk Bartos avatar Alexander Milevski avatar  avatar

Watchers

 avatar

kklayout's Issues

Thanks you, you just saved my day

You just saved my day. Thank you so much (yes, this is an issue since I can not find another way to contact you).

There're still some cases where the graph is broken, but it's not so important for my case.

Anyway, let me send you beer-money or something.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.