> For the complete documentation index, see [llms.txt](https://gitbook.testingwaters.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.testingwaters.in/geometry-1/group-branching-curves.md).

# Group Branching Curves

![](/files/-Lh9AaisLJyF-ikUfMR0)

```d
//All Vertices (Start and End Points of Lines)
a = Point.PruneDuplicates(List.Flatten([lns.StartPoint,lns.EndPoint],-1));

//Index of Start and End Points in list of Vertices
b = List.Transpose([List.IndexOf(a,lns.StartPoint),List.IndexOf(a,lns.EndPoint)]);
c = List.Flatten(List.Permutations(b,3)<1>,-1);

//Obtain indices of connected vertices
d = List.GetItemAtIndex(c<2>,(0..5)<1>);
e1 = d[0]==d[5] && d[1]==d[2] && d[3]==d[4];
e2 = d[1]==d[5] && d[0]==d[2] && d[3]==d[4];
f = List.UniqueItems(List.FilterByBoolMask(c,e1 || e2)["in"]<1>);
g = List.UniqueItems(List.Sort(f));
h = List.GetItemAtIndex(a,g);

//Surfaces
srf = Surface.ByPerimeterPoints(h);
```

```d
//Sample Lines
Line.ByStartPointEndPoint(Point.ByCoordinates([0,0,1,1,12,7,15,12],
[0,0,9,9,10,5,6,1]),Point.ByCoordinates([7,1,7,12,7,15,12,7],[5,9,5,10,5,6,1,5]));
```

![](/files/-Lh9AX_94K70Mi8RWbBT)
