How to name nodes in a graph in the English language?
I need to define an el开发者_如何学Pythonement from linkedList in a object:
A
/ \ X Y
How could I name the entire object and its components in English?
à la: Hand-Body-Leg
object named Body
. or maybe somthing like queue kernel hand
treeObject
?
Ok, let's show you the example of a railway:
NodeStation => Station => Station => Station => NodeStation => Station => Station => NodeStation => ...
I need to have an object (NodeStationAndNeighbourdStations
) with following 3 elements: NodeStation
, LeftNeighbor
, RightNeighbor
in a more general manner.
Node Node
| |
------ Parent ------ --- A ---
| | | |
Left child Right child X Y
The whole object I'd call Node.
Perhaps this is the kind of naming you mean - a node that consists of:
A - parent/head X - left child/node Y - right child/node
Are X and Y children of A? That is what many will infer from your diagram. If instead A,X, and Y are merely strings then you have 3 fields that could be within some class name. The question is what are the slashes supposed to imply is where I think 99% of the problem is here.
Given the edits to the question, I'm thinking that the other ideas of this being a binary tree are correct where A, X, and Y are all Nodes of the tree, where A is the Root, with X as its Left Child, Y as its Right Child and the whole structure called a Binary Tree, assuming that there are only 2 children allowed per node. If there can be any number of children then this is a different structure. However, this isn't a Linked List to my mind in the traditional sense as usually a linked list is depicted in linear terms,e.g. A->X->Y so that each node is only pointing at one node, with the anomaly of a doubly-linked list being separate as usually a linked list is a singly-linked list to my mind.
I'm still confused by what that picture is supposed to imply. If someone is at A, do they see X and Y, while at X or Y they only see A? Are all three elements of a class and the diagram isn't useful as there isn't a point in displaying them this way? Would there be other elements that may contain X or Y as the parent node or is it that each node in the tree contains 3 elements like A,X,Y and there isn't any connection among the elements? This is a very confusing picture as this isn't looking like many other graph-like structures I've seen.
So, A is a NodeStation and each of X and Y are Stations. Thus, each is a separate element of the list? Perhaps a better way to display this would be
... => X <=> A <=> Y <=...
Though even that has some challenges to it, in terms of understanding what is and isn't implied.
I'm not sure what you mean (or even if this question is supposed to be on stackoverflow) but wouldn't you just call it the Tree, the left node and the right node ?
parent -> child
?
Finally, the taken solution was
ListElement(Previous, Root, Following)
It's a link really. Like a link in a chain. Hence linked list.
精彩评论