Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
graphtodtreeconverter
Advanced tools
Readme
This module converts a given graph data structure to the data format that can be used by the dTree visualizing library from ErikGartner (https://github.com/ErikGartner/dTree).
To visualize a family tree with the dTree library you have to provide the data in a hierarchical format:
Parent1:
Marriage:
Parent2
Childs...
Child1
Child2
Marriage:
PersonX
Childs:
...
...
With this data format it's not possible to save multiple family trees. Also it's only possible to render one parent history with the dTree library.
But i wanted to have the possiblity to save multiple family trees (for Parent1
and Parent2
) in one data structure. The rendering of multiple family trees wasn't important to me.
So I created a (graph) data structure that can be converted to the necessary dTree format.
FamilyGraphData
{
"persons": [
{
"id": 0,
"name": "Parent1",
"gender": "man"
},
{
"id": 1,
"name": "Parent2",
"gender": "woman"
},
{
"id": 2,
"name": "Child1",
"gender": "woman"
},
{
"id": 3,
"name": "Child2",
"gender": "man"
}
],
"connections": [
{
"partner1Id": 0,
"partner2Id": 1,
"childrenIds": [2, 3]
}
]
}
It's important to note, that the first person has the id 0 and that there is no gap between the ids.
const GraphToDTreeConverter = require("graphtodtreeconverter");
var familyRelations = GraphToDTreeConverter(
FamilyGraphData,
rootId);
FamilyGraphData
: The graph data structure
rootId
: The id of the person which family tree should be generated
If the given person (rootId
) has additional parent informations, the root of the family tree will be changed to the "first" parent.
The call of GraphToDTreeConverter(FamilyGraphData, 2)
will result in:
[
{
name: 'Parent1',
class: 'man',
extra: {
id: 0
},
marriages: [
{
spouse: {
name: 'Parent2',
class: 'woman',
extra: {
id: 1
}
},
children: [
{
name: 'Child1',
class: 'woman',
extra: {
id: 2
}
},
{
name: 'Child2',
class: 'man',
extra: {
id: 3
}
}
]
}
]
}
]
FAQs
Converts a given graph structure to a format that can be used by the dTree library
The npm package graphtodtreeconverter receives a total of 1 weekly downloads. As such, graphtodtreeconverter popularity was classified as not popular.
We found that graphtodtreeconverter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.