Breadthfirst layout of parents, not child nodes - layout

I'm interested in creating a graph of parent nodes each containing 1 or more child nodes to be placed via co-ordinates. Child nodes will have edges to other child nodes in the graph.
I would then like to perform a breadthfirst layout on the parents, without disturbing the local position of the child nodes.
Is this possible in Cytoscape.js? Will I need to write a custom layout module?

Compound nodes don't really have independent positions and dimensions: A parent is wholly dependent on children for to fit its position and dimensions.
To do what you suggest, you'd need to move all the descendants of a parent to effectively move the parent. For that, you'd need unique layout logic.
You could probably just use the scaffolder and copy the breadthfirst code as a basis -- modifying it for what you need. If you want to have it public, it could be a nice layout extension in the listing.

Related

How to propagate attributes to child or inherit from parent?

Many of my spans are more useful if they inherit many attributes from the parent. Performing queries using Honeycomb for example, it's not possible to query spans based on properties that parent or child spans might have, and many of the attributes of the parents are relevant to the specific span for querying it in isolation. Other than recording them manually (if they're in scope when the child span is created), or perhaps pushing attributes that are intended to be inherited into baggage, and pulling them out on a per-span basis, what are my options here?
How do I propagate attributes to child spans?

(Godot) They are also nodes of objects

I want to understand if for example a game object like a SPRITE that if inserted alone represents a scene in godot is related to the concept of OOP object, in practice I want to understand if it is also an OOP object....
In Godot, a node is an object. Not all objects are nodes.
We can see the documentation for Node, that it inherits from Object, where Object is the base class for everything in Godot.
And, of course, Sprite is a Node.
So, all Sprites are Nodes, and all Nodes are Objects.
What is a scene?
First of all, scenes are not C++ classes. I hope this is evident.
Second, there is something called scene inheritance, which suggest scenes are some kind of classes. However, we cannot extend them in code. Scenes are not classes.
Third, we can create Nodes from scene files. If the scene file is not a class, that suggest they are prototypes. But if scenes are prototypes, how do we explain scene inheritance? Well, as it turns out, scenes are not prototypes. It is much simpler than that…
Scenes are Nodes.
As you know, when you tell Godot to add a scene file to the Scene panel you get an item that has a special icon. And - by default - you don't see any children that where in that scene file. This is only they way they are shown in the UI.
Perhaps you wonder how does it look like in memory. Is there a special type of Node for any scene files you add? And the answer is NO. They are regular Nodes.
When you tell Godot to add a scene file to the Scene panel, Godot loads it and instantiate it, getting a Node. Then Godot adds that Node as a child where you told it.
So how does it remember that that Node was added from a scene file?
The Nodes have a filename property that tell us from where it was loaded. So when you are serializing a Node to an scene file, and it has some child Node that has a filename set, instead of serializing that child Node to the same scene file... It is serialized to the file indicated by its filename, and then included by reference.
Of course, the filename property is not visible in the Inspector panel.
But then, what is scene inheritance?
When you have a serialized scene Node (i.e. a scene file), it contains the properties, scripts, children, connections and so on. And as said above, it can include other files by reference.
Scene inheritance is the special case of inclusion where the serialized Node is defined as another scene. That is scene inheritance is extension by inclusion.
Finally there is something called SceneTree. The game will have an SceneTree object (unless you instantiate more), and it references a Node which is considered the current scene.

Explanation why empty scenekit scene without ship has one node and 2.73K polygons

Why does an empty scenekit scene with the ship removed have one node and a 2.73K polygon count? If I expand the statistics view, there are two nodes and 5.46K polygons. It has to do something with the statistics view, but why so many polygons? And why is this view inside the scene?
An empty SceneKit scene has always at least one node, because the node is the root node. It is the node to which you can add your other nodes as child nodes.

Dragging nested components into a diagram in Sparx Enterprise Architect (EA)

In my Enterprise Architect model, I have nodes that contain devices that contain components that contain other components. That's how I organized the hierarchy in the Project Browser.
I would like to be able to drag one element of the model into a diagram (as a Link), and be able to see all the elements contained by this element without having to drag them individually. For example, dragging a device into a deployment diagram would display the node and all the components it contains.
This logic works when I drag a component onto a diagram: I am able to select what children elements (interfaces, ports, ...) I want to see on the diagram. But I did not find a way to do the same with this following containment hierarchy: node > device > component > subcomponent.
Is there a way to do so ?
Thank you :)
You can do it manually, of course. Dragging the outermost onto the diagram (as link) and enlarge it. Drag the inner ones onto the diagram somewhere outside the outer one (to avoid some dialog otherwise). Drag them inside the outer and arrange as needed.
Another way is to make the outer element composite (context/Add/Composite diagram or /New Diagram/Composite). On this composite diagram place the inner elements and arrange them. Save the diagram when done. Now you can create diagrams with the outer element which, once enlarged, can show the composite diagram inside. Just drag the composite diagram as Diagram Frame and eventually make it smaller. Then place it inside the enlarged outer component.
While in the first case you can show relations (like port delegation) this is not possible in the second one.
There is no way to automagically drop the nested structure except you come up with some very tricky add-in.

How to have multiple instances on the screen of the same sprite at the same time with javafx2

I'm quite new in programming and especially with javafx.
I'm writing a game and i'm trying to visualize at the same time more instances of the same sprite ( a kind of bullet). It translates and rotates.
In my attempts program doesn't work or normally when press 'fire', bullet run but when press 'fire' more times, every time the 'old' bullet' disappear and another bullet starts. Only 1 bullet on the screen at the same time. What have i to do to have more bullets on the screen, exactly one bullet for every time 'fire' is pressed?
Thank you in advance!
You are probably trying to add the same node more than once to the scene graph.
From the JavaFX Node documentation:
A node may occur at most once anywhere in the scene graph. Specifically, a node must appear no more than once in all of the following: as the root node of a Scene, the children ObservableList of a Parent, or as the clip of a Node.
The scene graph must not have cycles. A cycle would exist if a node is an ancestor of itself in the tree, considering the Group content ObservableList, Parent children ObservableList, and Node clip relationships mentioned above.
If a program adds a child node to a Parent (including Group, Region, etc) and that node is already a child of a different Parent or the root of a Scene, the node is automatically (and silently) removed from its former parent. If a program attempts to modify the scene graph in any other way that violates the above rules, an exception is thrown, the modification attempt is ignored and the scene graph is restored to its previous state.
It is possible to rearrange the structure of the scene graph, for example, to move a subtree from one location in the scene graph to another. In order to do this, one would normally remove the subtree from its old location before inserting it at the new location. However, the subtree will be automatically removed as described above if the application doesn't explicitly remove it.
Here is a sample of multiple animated images in a single scene. In the example, multiple nodes are used, each sharing the same Image data. Because Image is not a Node, it can be shared without issue:
How show specific part of an image in javafx

Resources