Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #32695 > unrolled thread

Remove links

Started byjonas.thornvall@gmail.com
First post2017-03-05 15:00 -0800
Last post2017-03-16 03:39 -0700
Articles 10 — 2 participants

Back to article view | Back to comp.lang.javascript


Contents

  Remove links jonas.thornvall@gmail.com - 2017-03-05 15:00 -0800
    Re: Remove links jonas.thornvall@gmail.com - 2017-03-06 02:26 -0800
    Re: Remove links JJ <jj4public@vfemail.net> - 2017-03-06 18:12 +0700
      Re: Remove links jonas.thornvall@gmail.com - 2017-03-06 05:52 -0800
        Re: Remove links jonas.thornvall@gmail.com - 2017-03-10 17:22 -0800
          Re: Remove links jonas.thornvall@gmail.com - 2017-03-15 01:21 -0700
            Re: Remove links jonas.thornvall@gmail.com - 2017-03-15 01:52 -0700
        Re: Remove links jonas.thornvall@gmail.com - 2017-03-15 05:11 -0700
          Re: Remove links jonas.thornvall@gmail.com - 2017-03-16 01:26 -0700
            Re: Remove links jonas.thornvall@gmail.com - 2017-03-16 03:39 -0700

#32695 — Remove links

Fromjonas.thornvall@gmail.com
Date2017-03-05 15:00 -0800
SubjectRemove links
Message-ID<0b2b904e-4692-41df-9afa-09e75baf6564@googlegroups.com>
My function to create links from a list of marke nodes work fine, so i thought rather than reinvent the wheel i use the same function to remove links, replacing push with splice i have not debugged yet because i can't see why the approach should not work. If someone understand the problem just by a look, i would be greatful if you explain it.

function createMarkedLinks() {//Works
    var y = 0;
    for (var t = 0; t < marklist.length - 1; t++) {
        var x = y;
        y++;
        currentnode = marklist[t];
        //  alert("currentnode="+ marklist[t]);
        for (var s = 1 + x; s < marklist.length; s++) {
            nextnode = marklist[s];
            x++;
            inarray = arr[currentnode].nodelinks.indexOf(nextnode);
            if (inarray == -1) {
                arr[currentnode].nodelinks.push(nextnode);
                arr[nextnode].nodelinks.push(currentnode);
            }
        }
    }
    autotext = "";
    update_GraphData();
}

function removeMarkedLinks() {
//Do not work but i don't see why it is just the same process in reverse?
    var y = 0;
    for (var t = 0; t < marklist.length - 1; t++) {
        var x = y;
        y++;
        currentnode = marklist[t];
        alert("removeMarkedLinks");
        for (var s = 1 + x; s < marklist.length; s++) {
            nextnode = marklist[s];
            x++;
            inarray = arr[currentnode].nodelinks.indexOf(nextnode);
            if (inarray == -1) {
                arr[currentnode].nodelinks.splice(nextnode,1);
                arr[nextnode].nodelinks.splice(currentnode,1);
            }
        }
    }
    autotext = "";
    update_GraphData();
}

[toc] | [next] | [standalone]


#32697

Fromjonas.thornvall@gmail.com
Date2017-03-06 02:26 -0800
Message-ID<1befe921-8390-4e5b-854e-6497bd172bda@googlegroups.com>
In reply to#32695
Den måndag 6 mars 2017 kl. 00:00:59 UTC+1 skrev jonas.t...@gmail.com:
> My function to create links from a list of marke nodes work fine, so i thought rather than reinvent the wheel i use the same function to remove links, replacing push with splice i have not debugged yet because i can't see why the approach should not work. If someone understand the problem just by a look, i would be greatful if you explain it.
> 
> function createMarkedLinks() {//Works
>     var y = 0;
>     for (var t = 0; t < marklist.length - 1; t++) {
>         var x = y;
>         y++;
>         currentnode = marklist[t];
>         //  alert("currentnode="+ marklist[t]);
>         for (var s = 1 + x; s < marklist.length; s++) {
>             nextnode = marklist[s];
>             x++;
>             inarray = arr[currentnode].nodelinks.indexOf(nextnode);
>             if (inarray == -1) {
>                 arr[currentnode].nodelinks.push(nextnode);
>                 arr[nextnode].nodelinks.push(currentnode);
>             }
>         }
>     }
>     autotext = "";
>     update_GraphData();
> }
> 
> function removeMarkedLinks() {
> //Do not work but i don't see why it is just the same process in reverse?
>     var y = 0;
>     for (var t = 0; t < marklist.length - 1; t++) {
>         var x = y;
>         y++;
>         currentnode = marklist[t];
>         alert("removeMarkedLinks");
>         for (var s = 1 + x; s < marklist.length; s++) {
>             nextnode = marklist[s];
>             x++;
>             inarray = arr[currentnode].nodelinks.indexOf(nextnode);
>             if (inarray == -1) {
>                 arr[currentnode].nodelinks.splice(nextnode,1);
>                 arr[nextnode].nodelinks.splice(currentnode,1);
>             }
>         }
>     }
>     autotext = "";
>     update_GraphData();
> }

Well the first thing that had to be changed was of course the inarray, it should be the opposite you can only remove links actually there.
But it still only manage to remove one of the double chained node links.

function removeMarkedLinks() {
    var y = 0;
    for (var t = 0; t < marklist.length - 1; t++) {
        var x = y;
        y++;
        currentnode = marklist[t];
        alert("marklist="+marklist);
        for (var s = 1 + x; s < marklist.length; s++) {
            nextnode = marklist[s];
             alert("currentnode="+currentnode+" nextnode="+nextnode);
            x++;
            inarray = arr[currentnode].nodelinks.indexOf(nextnode);
            if (inarray != -1) {
               alert("nextnode="+arr[currentnode].nodelinks[nextnode]);
               arr[currentnode].nodelinks.splice(nextnode,1);
               arr[nextnode].nodelinks.splice(currentnode,1);
           }
        }
    }
    autotext = "Marked="+marklist+"\n";
    update_GraphData();
}

[toc] | [prev] | [next] | [standalone]


#32698

FromJJ <jj4public@vfemail.net>
Date2017-03-06 18:12 +0700
Message-ID<4v2lk5osyqci.96v522es0gyo$.dlg@40tude.net>
In reply to#32695
On Sun, 5 Mar 2017 15:00:47 -0800 (PST), jonas.thornvall@gmail.com wrote:
> My function to create links from a list of marke nodes work fine, so i
> thought rather than reinvent the wheel i use the same function to remove
> links, replacing push with splice i have not debugged yet because i can't
> see why the approach should not work. If someone understand the problem
> just by a look, i would be greatful if you explain it.
> 
> function createMarkedLinks() {//Works
[snip]

Can't be tested without knowing the initial array contents of `marklist` and
`arr`.

[toc] | [prev] | [next] | [standalone]


#32699

Fromjonas.thornvall@gmail.com
Date2017-03-06 05:52 -0800
Message-ID<c4cec846-0e38-497a-87ca-3c8230eeca61@googlegroups.com>
In reply to#32698
Den måndag 6 mars 2017 kl. 12:12:19 UTC+1 skrev JJ:
> On Sun, 5 Mar 2017 15:00:47 -0800 (PST), jonas.thornvall@gmail.com wrote:
> > My function to create links from a list of marke nodes work fine, so i
> > thought rather than reinvent the wheel i use the same function to remove
> > links, replacing push with splice i have not debugged yet because i can't
> > see why the approach should not work. If someone understand the problem
> > just by a look, i would be greatful if you explain it.
> > 
> > function createMarkedLinks() {//Works
> [snip]
> 
> Can't be tested without knowing the initial array contents of `marklist` and
> `arr`.

http://anybase.co.nf

Well arr[].nodelinks[] are just integers
And so are markedlist[] it is a list of *MARKED* arr[] integer elements

Say marklist hold 1,2,3 then createMarkedLinks connect them by set nodelinks for each node. See script Graphdata.

And of course to remove links there must already be links, so if 1,2,3 marked to be removed the doublechained connections/links below should be spliced. 
arrlinks[1].nodelinks[2], arrlinks[1].nodelinks[3]
arrlinks[2].nodelinks[1],arrlinks[2].nodelinks[3]
arrlinks[3].nodelinks[1],arrlinks[3].nodelinks[2]

[toc] | [prev] | [next] | [standalone]


#32716

Fromjonas.thornvall@gmail.com
Date2017-03-10 17:22 -0800
Message-ID<331d8d6c-64ca-4e78-816e-e234788122e9@googlegroups.com>
In reply to#32699
Den måndag 6 mars 2017 kl. 14:52:46 UTC+1 skrev jonas.t...@gmail.com:
> Den måndag 6 mars 2017 kl. 12:12:19 UTC+1 skrev JJ:
> > On Sun, 5 Mar 2017 15:00:47 -0800 (PST), jonas.thornvall@gmail.com wrote:
> > > My function to create links from a list of marke nodes work fine, so i
> > > thought rather than reinvent the wheel i use the same function to remove
> > > links, replacing push with splice i have not debugged yet because i can't
> > > see why the approach should not work. If someone understand the problem
> > > just by a look, i would be greatful if you explain it.
> > > 
> > > function createMarkedLinks() {//Works
> > [snip]
> > 
> > Can't be tested without knowing the initial array contents of `marklist` and
> > `arr`.
> 
> http://anybase.co.nf
> 
> Well arr[].nodelinks[] are just integers
> And so are markedlist[] it is a list of *MARKED* arr[] integer elements
> 
> Say marklist hold 1,2,3 then createMarkedLinks connect them by set nodelinks for each node. See script Graphdata.
> 
> And of course to remove links there must already be links, so if 1,2,3 marked to be removed the doublechained connections/links below should be spliced. 
> arrlinks[1].nodelinks[2], arrlinks[1].nodelinks[3]
> arrlinks[2].nodelinks[1],arrlinks[2].nodelinks[3]
> arrlinks[3].nodelinks[1],arrlinks[3].nodelinks[2]

Well the linkremoval i will fix tomorrow, but i did fix node removal with reordering and that was a bit hairy to think out. It probably would been easier remove all the nodes and make the reorder afterwards. But thinking a bit deeper i managed to see into the future.It is a pretty hard thing making a list that is changed as you remove items and still get it right.
http://anybase.co.nf

function RMN() {
    if (z > -1) {
        var tr = arr[z].nodelinks.length;
        for (s = 0; s < tr; s++) {
            remove = arr[z].nodelinks[s];
            var index = arr[remove].nodelinks.indexOf(z);
            arr[remove].nodelinks.splice(index, 1);
        }
        arr[z].nodelinks = [];
    }
    if (zeromark == true) {
        marklist.pop();
    } else {
        marklist.splice(0, 1);
    }
    reOrderArr(z);
    autotext = "Marked=" + marklist + "\n";
    update_GraphData();
}

function removeMarkedNodes() {
    iterate = marklist.length;
    for (var x = 0; x < iterate; x++) {
        z = marklist[0];
        if (arr[arr.length - 1].bcolor == "red") {
            zeromark = true;
        } else {
            zeromark = false;
        }
        //  alert(z);
        RMN(z);
        update_Marklist();
    }
}




[toc] | [prev] | [next] | [standalone]


#32756

Fromjonas.thornvall@gmail.com
Date2017-03-15 01:21 -0700
Message-ID<070b8d46-ca59-4202-bdb9-d93d31e38792@googlegroups.com>
In reply to#32716
Den lördag 11 mars 2017 kl. 02:22:34 UTC+1 skrev jonas.t...@gmail.com:
> Den måndag 6 mars 2017 kl. 14:52:46 UTC+1 skrev jonas.t...@gmail.com:
> > Den måndag 6 mars 2017 kl. 12:12:19 UTC+1 skrev JJ:
> > > On Sun, 5 Mar 2017 15:00:47 -0800 (PST), jonas.thornvall@gmail.com wrote:
> > > > My function to create links from a list of marke nodes work fine, so i
> > > > thought rather than reinvent the wheel i use the same function to remove
> > > > links, replacing push with splice i have not debugged yet because i can't
> > > > see why the approach should not work. If someone understand the problem
> > > > just by a look, i would be greatful if you explain it.
> > > > 
> > > > function createMarkedLinks() {//Works
> > > [snip]
> > > 
> > > Can't be tested without knowing the initial array contents of `marklist` and
> > > `arr`.
> > 
> > http://anybase.co.nf
> > 
> > Well arr[].nodelinks[] are just integers
> > And so are markedlist[] it is a list of *MARKED* arr[] integer elements
> > 
> > Say marklist hold 1,2,3 then createMarkedLinks connect them by set nodelinks for each node. See script Graphdata.
> > 
> > And of course to remove links there must already be links, so if 1,2,3 marked to be removed the doublechained connections/links below should be spliced. 
> > arrlinks[1].nodelinks[2], arrlinks[1].nodelinks[3]
> > arrlinks[2].nodelinks[1],arrlinks[2].nodelinks[3]
> > arrlinks[3].nodelinks[1],arrlinks[3].nodelinks[2]
> 
> Well the linkremoval i will fix tomorrow, but i did fix node removal with reordering and that was a bit hairy to think out. It probably would been easier remove all the nodes and make the reorder afterwards. But thinking a bit deeper i managed to see into the future.It is a pretty hard thing making a list that is changed as you remove items and still get it right.
> http://anybase.co.nf
> 
> function RMN() {
>     if (z > -1) {
>         var tr = arr[z].nodelinks.length;
>         for (s = 0; s < tr; s++) {
>             remove = arr[z].nodelinks[s];
>             var index = arr[remove].nodelinks.indexOf(z);
>             arr[remove].nodelinks.splice(index, 1);
>         }
>         arr[z].nodelinks = [];
>     }
>     if (zeromark == true) {
>         marklist.pop();
>     } else {
>         marklist.splice(0, 1);
>     }
>     reOrderArr(z);
>     autotext = "Marked=" + marklist + "\n";
>     update_GraphData();
> }
> 
> function removeMarkedNodes() {
>     iterate = marklist.length;
>     for (var x = 0; x < iterate; x++) {
>         z = marklist[0];
>         if (arr[arr.length - 1].bcolor == "red") {
>             zeromark = true;
>         } else {
>             zeromark = false;
>         }
>         //  alert(z);
>         RMN(z);
>         update_Marklist();
>     }
> }

Fixed the linkremoval it was just the indexOf missing.
So now a rudimentary graph editor working.
http://anybase.co.nf

[toc] | [prev] | [next] | [standalone]


#32758

Fromjonas.thornvall@gmail.com
Date2017-03-15 01:52 -0700
Message-ID<80ea9771-58a7-46cb-bdaf-1af4d91b2274@googlegroups.com>
In reply to#32756
Den onsdag 15 mars 2017 kl. 09:22:01 UTC+1 skrev jonas.t...@gmail.com:
> Den lördag 11 mars 2017 kl. 02:22:34 UTC+1 skrev jonas.t...@gmail.com:
> > Den måndag 6 mars 2017 kl. 14:52:46 UTC+1 skrev jonas.t...@gmail.com:
> > > Den måndag 6 mars 2017 kl. 12:12:19 UTC+1 skrev JJ:
> > > > On Sun, 5 Mar 2017 15:00:47 -0800 (PST), jonas.thornvall@gmail.com wrote:
> > > > > My function to create links from a list of marke nodes work fine, so i
> > > > > thought rather than reinvent the wheel i use the same function to remove
> > > > > links, replacing push with splice i have not debugged yet because i can't
> > > > > see why the approach should not work. If someone understand the problem
> > > > > just by a look, i would be greatful if you explain it.
> > > > > 
> > > > > function createMarkedLinks() {//Works
> > > > [snip]
> > > > 
> > > > Can't be tested without knowing the initial array contents of `marklist` and
> > > > `arr`.
> > > 
> > > http://anybase.co.nf
> > > 
> > > Well arr[].nodelinks[] are just integers
> > > And so are markedlist[] it is a list of *MARKED* arr[] integer elements
> > > 
> > > Say marklist hold 1,2,3 then createMarkedLinks connect them by set nodelinks for each node. See script Graphdata.
> > > 
> > > And of course to remove links there must already be links, so if 1,2,3 marked to be removed the doublechained connections/links below should be spliced. 
> > > arrlinks[1].nodelinks[2], arrlinks[1].nodelinks[3]
> > > arrlinks[2].nodelinks[1],arrlinks[2].nodelinks[3]
> > > arrlinks[3].nodelinks[1],arrlinks[3].nodelinks[2]
> > 
> > Well the linkremoval i will fix tomorrow, but i did fix node removal with reordering and that was a bit hairy to think out. It probably would been easier remove all the nodes and make the reorder afterwards. But thinking a bit deeper i managed to see into the future.It is a pretty hard thing making a list that is changed as you remove items and still get it right.
> > http://anybase.co.nf
> > 
> > function RMN() {
> >     if (z > -1) {
> >         var tr = arr[z].nodelinks.length;
> >         for (s = 0; s < tr; s++) {
> >             remove = arr[z].nodelinks[s];
> >             var index = arr[remove].nodelinks.indexOf(z);
> >             arr[remove].nodelinks.splice(index, 1);
> >         }
> >         arr[z].nodelinks = [];
> >     }
> >     if (zeromark == true) {
> >         marklist.pop();
> >     } else {
> >         marklist.splice(0, 1);
> >     }
> >     reOrderArr(z);
> >     autotext = "Marked=" + marklist + "\n";
> >     update_GraphData();
> > }
> > 
> > function removeMarkedNodes() {
> >     iterate = marklist.length;
> >     for (var x = 0; x < iterate; x++) {
> >         z = marklist[0];
> >         if (arr[arr.length - 1].bcolor == "red") {
> >             zeromark = true;
> >         } else {
> >             zeromark = false;
> >         }
> >         //  alert(z);
> >         RMN(z);
> >         update_Marklist();
> >     }
> > }
> 
> Fixed the linkremoval it was just the indexOf missing.
> So now a rudimentary graph editor working.
> http://anybase.co.nf

Next a draw tool, and maybe some manipulations rectangular reshaping, zoom area, move marked, cut, copy, paste and rotate.

[toc] | [prev] | [next] | [standalone]


#32760

Fromjonas.thornvall@gmail.com
Date2017-03-15 05:11 -0700
Message-ID<d6107912-11c4-4e2c-8028-5ab3ebc1c552@googlegroups.com>
In reply to#32699
Den måndag 6 mars 2017 kl. 14:52:46 UTC+1 skrev jonas.t...@gmail.com:
> Den måndag 6 mars 2017 kl. 12:12:19 UTC+1 skrev JJ:
> > On Sun, 5 Mar 2017 15:00:47 -0800 (PST), jonas.thornvall@gmail.com wrote:
> > > My function to create links from a list of marke nodes work fine, so i
> > > thought rather than reinvent the wheel i use the same function to remove
> > > links, replacing push with splice i have not debugged yet because i can't
> > > see why the approach should not work. If someone understand the problem
> > > just by a look, i would be greatful if you explain it.
> > > 
> > > function createMarkedLinks() {//Works
> > [snip]
> > 
> > Can't be tested without knowing the initial array contents of `marklist` and
> > `arr`.
> 
> http://anybase.co.nf
> 
> Well arr[].nodelinks[] are just integers
> And so are markedlist[] it is a list of *MARKED* arr[] integer elements
> 
> Say marklist hold 1,2,3 then createMarkedLinks connect them by set nodelinks for each node. See script Graphdata.
> 
> And of course to remove links there must already be links, so if 1,2,3 marked to be removed the doublechained connections/links below should be spliced. 
> arrlinks[1].nodelinks[2], arrlinks[1].nodelinks[3]
> arrlinks[2].nodelinks[1],arrlinks[2].nodelinks[3]
> arrlinks[3].nodelinks[1],arrlinks[3].nodelinks[2]

function removeMarkedLinks() {
    var y = 0;
    for (var t = 0; t < marklist.length - 1; t++) {
        var x = y;
        y++;
        currentnode = marklist[t];
        for (var s = 1 + x; s < marklist.length; s++) {
            nextnode = marklist[s];
            x++;
            inarray = arr[currentnode].nodelinks.indexOf(nextnode);
            if (inarray != -1) {
               var linkindex = arr[currentnode].nodelinks.indexOf(nextnode);
               arr[currentnode].nodelinks.splice(linkindex,1);
               linkindex = arr[nextnode].nodelinks.indexOf(currentnode);
               arr[nextnode].nodelinks.splice(linkindex,1);
           }
        }
    }
    autotext = "Marked="+marklist+"\n";
    update_GraphData();
}

[toc] | [prev] | [next] | [standalone]


#32779

Fromjonas.thornvall@gmail.com
Date2017-03-16 01:26 -0700
Message-ID<aa785a59-091e-47bb-89d0-b69f8768ce73@googlegroups.com>
In reply to#32760
Den onsdag 15 mars 2017 kl. 13:11:17 UTC+1 skrev jonas.t...@gmail.com:
> Den måndag 6 mars 2017 kl. 14:52:46 UTC+1 skrev jonas.t...@gmail.com:
> > Den måndag 6 mars 2017 kl. 12:12:19 UTC+1 skrev JJ:
> > > On Sun, 5 Mar 2017 15:00:47 -0800 (PST), jonas.thornvall@gmail.com wrote:
> > > > My function to create links from a list of marke nodes work fine, so i
> > > > thought rather than reinvent the wheel i use the same function to remove
> > > > links, replacing push with splice i have not debugged yet because i can't
> > > > see why the approach should not work. If someone understand the problem
> > > > just by a look, i would be greatful if you explain it.
> > > > 
> > > > function createMarkedLinks() {//Works
> > > [snip]
> > > 
> > > Can't be tested without knowing the initial array contents of `marklist` and
> > > `arr`.
> > 
> > http://anybase.co.nf
> > 
> > Well arr[].nodelinks[] are just integers
> > And so are markedlist[] it is a list of *MARKED* arr[] integer elements
> > 
> > Say marklist hold 1,2,3 then createMarkedLinks connect them by set nodelinks for each node. See script Graphdata.
> > 
> > And of course to remove links there must already be links, so if 1,2,3 marked to be removed the doublechained connections/links below should be spliced. 
> > arrlinks[1].nodelinks[2], arrlinks[1].nodelinks[3]
> > arrlinks[2].nodelinks[1],arrlinks[2].nodelinks[3]
> > arrlinks[3].nodelinks[1],arrlinks[3].nodelinks[2]
> 
> function removeMarkedLinks() {
>     var y = 0;
>     for (var t = 0; t < marklist.length - 1; t++) {
>         var x = y;
>         y++;
>         currentnode = marklist[t];
>         for (var s = 1 + x; s < marklist.length; s++) {
>             nextnode = marklist[s];
>             x++;
>             inarray = arr[currentnode].nodelinks.indexOf(nextnode);
>             if (inarray != -1) {
>                var linkindex = arr[currentnode].nodelinks.indexOf(nextnode);
>                arr[currentnode].nodelinks.splice(linkindex,1);
>                linkindex = arr[nextnode].nodelinks.indexOf(currentnode);
>                arr[nextnode].nodelinks.splice(linkindex,1);
>            }
>         }
>     }
>     autotext = "Marked="+marklist+"\n";
>     update_GraphData();
> }

Fixed a drawtool that create linked nodes and will merge a link when you point to an already existing nodes.

Two things could work smoother now it always draw a link from last drawn node, when you start the drawtool, ability to release the subgraph you are doing to create another unlinked one.  

It would also be nice to be able to point to an already existing node as start point, but i would have to think about howto handle both that and release drawing of subgraph.

[toc] | [prev] | [next] | [standalone]


#32781

Fromjonas.thornvall@gmail.com
Date2017-03-16 03:39 -0700
Message-ID<2d004944-53c3-47e1-90e2-5a4ebcf11794@googlegroups.com>
In reply to#32779
Den torsdag 16 mars 2017 kl. 09:26:22 UTC+1 skrev jonas.t...@gmail.com:
> Den onsdag 15 mars 2017 kl. 13:11:17 UTC+1 skrev jonas.t...@gmail.com:
> > Den måndag 6 mars 2017 kl. 14:52:46 UTC+1 skrev jonas.t...@gmail.com:
> > > Den måndag 6 mars 2017 kl. 12:12:19 UTC+1 skrev JJ:
> > > > On Sun, 5 Mar 2017 15:00:47 -0800 (PST), jonas.thornvall@gmail.com wrote:
> > > > > My function to create links from a list of marke nodes work fine, so i
> > > > > thought rather than reinvent the wheel i use the same function to remove
> > > > > links, replacing push with splice i have not debugged yet because i can't
> > > > > see why the approach should not work. If someone understand the problem
> > > > > just by a look, i would be greatful if you explain it.
> > > > > 
> > > > > function createMarkedLinks() {//Works
> > > > [snip]
> > > > 
> > > > Can't be tested without knowing the initial array contents of `marklist` and
> > > > `arr`.
> > > 
> > > http://anybase.co.nf
> > > 
> > > Well arr[].nodelinks[] are just integers
> > > And so are markedlist[] it is a list of *MARKED* arr[] integer elements
> > > 
> > > Say marklist hold 1,2,3 then createMarkedLinks connect them by set nodelinks for each node. See script Graphdata.
> > > 
> > > And of course to remove links there must already be links, so if 1,2,3 marked to be removed the doublechained connections/links below should be spliced. 
> > > arrlinks[1].nodelinks[2], arrlinks[1].nodelinks[3]
> > > arrlinks[2].nodelinks[1],arrlinks[2].nodelinks[3]
> > > arrlinks[3].nodelinks[1],arrlinks[3].nodelinks[2]
> > 
> > function removeMarkedLinks() {
> >     var y = 0;
> >     for (var t = 0; t < marklist.length - 1; t++) {
> >         var x = y;
> >         y++;
> >         currentnode = marklist[t];
> >         for (var s = 1 + x; s < marklist.length; s++) {
> >             nextnode = marklist[s];
> >             x++;
> >             inarray = arr[currentnode].nodelinks.indexOf(nextnode);
> >             if (inarray != -1) {
> >                var linkindex = arr[currentnode].nodelinks.indexOf(nextnode);
> >                arr[currentnode].nodelinks.splice(linkindex,1);
> >                linkindex = arr[nextnode].nodelinks.indexOf(currentnode);
> >                arr[nextnode].nodelinks.splice(linkindex,1);
> >            }
> >         }
> >     }
> >     autotext = "Marked="+marklist+"\n";
> >     update_GraphData();
> > }
> 
> Fixed a drawtool that create linked nodes and will merge a link when you point to an already existing nodes.
> 
> Two things could work smoother now it always draw a link from last drawn node, when you start the drawtool, ability to release the subgraph you are doing to create another unlinked one.  
> 
> It would also be nice to be able to point to an already existing node as start point, but i would have to think about howto handle both that and release drawing of subgraph.

Fixed startdraw independent of lastnode, release the drawing sequense by press CTRL to create a new one.

Now i only need to be able to start from an existing node maybe by press shift.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web