A node is a basic unit of a
data structure
In computer science, a data structure is a data organization and storage format that is usually chosen for Efficiency, efficient Data access, access to data. More precisely, a data structure is a collection of data values, the relationships amo ...
, such as a
linked list
In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes whi ...
or
tree
In botany, a tree is a perennial plant with an elongated stem, or trunk, usually supporting branches and leaves. In some usages, the definition of a tree may be narrower, e.g., including only woody plants with secondary growth, only ...
data structure. Nodes contain
data
Data ( , ) are a collection of discrete or continuous values that convey information, describing the quantity, quality, fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpreted for ...
and also may link to other nodes. Links between nodes are often implemented by
pointers.
Nodes and trees
Nodes are often arranged into tree structures. A node represents the information contained in a single data structure. These nodes may contain a value or condition, or possibly serve as another independent data structure. Nodes are represented by a single parent node. The highest point on a tree structure is called a root node, which does not have a parent node, but serves as the parent or 'grandparent' of all of the nodes below it in the tree. The height of a node is determined by the total number of edges on the path from that node to the furthest leaf node, and the height of the tree is equal to the height of the root node. Node depth is determined by the distance between that particular node and the root node. The root node is said to have a depth of zero. Data can be discovered along these network paths.
An IP address uses this kind of system of nodes to define its location in a network.
Definitions
*Child: A child node is a node extending from another node. For example, a computer with internet access could be considered a child node of a node representing the internet. The inverse relationship is that of a parent node. If node ''C'' is a child of node ''A'', then ''A'' is the parent node of ''C''.
*Degree: the degree of a node is the number of children of the node.
*Depth: the depth of node ''A'' is the length of the path from ''A'' to the root node. The root node is said to have depth 0.
*Edge: the connection between nodes.
*Forest: a set of trees.
*Height: the height of node ''A'' is the length of the longest path through children to a leaf node.
*Internal node: a node with at least one child.
*Leaf node: a node with no children.
*Root node: a node distinguished from the rest of the tree nodes. Usually, it is depicted as the highest node of the tree.
*Sibling nodes: these are nodes connected to the same parent node.
Markup languages
Another common use of node trees is in
web development. In programming,
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for encoding electronic document, documents in a format that is both human-readable and Machine-r ...
is used to communicate information between computer programmers and computers alike. For this reason XML is used to create common
communication protocol
A communication protocol is a system of rules that allows two or more entities of a communications system to transmit information via any variation of a physical quantity. The protocol defines the rules, syntax, semantics (computer science), sem ...
s used in
office productivity software
Productivity software (also called personal productivity software or office productivity software) is application software used for producing information (such as documents, presentations, worksheets, databases, charts, Information graphics, graph ...
, and serves as the base for the development of modern web
markup language
A markup language is a Encoding, text-encoding system which specifies the structure and formatting of a document and potentially the relationships among its parts. Markup can control the display of a document or enrich its content to facilitate au ...
s like
XHTML
Extensible HyperText Markup Language (XHTML) is part of the family of XML markup languages which mirrors or extends versions of the widely used HyperText Markup Language (HTML), the language in which Web pages are formulated.
While HTML, pr ...
. Though similar in how it is approached by a programmer,
HTML
Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
and
CSS is typically the language used to develop website text and design. While XML, HTML and XHTML provide the language and expression, the
DOM serves as a translator.
Node type
Different types of nodes in a tree are represented by specific interfaces. In other words, the node type is defined by how it communicates with other nodes. Each node has a node type property, which specifies the type of node, such as sibling or leaf.
For example, if the node type property is the constant properties for a node, this property specifies the type of the node. So if a node type property is the constant node ELEMENT_NODE, one can know that this node object is an object Element. This object uses the Element interface to define all the methods and properties of that particular node.
Different W3C
World Wide Web Consortium
The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web. Founded in 1994 by Tim Berners-Lee, the consortium is made up of member organizations that maintain full-time staff working together in ...
node types and descriptions:
*Document represents the entire document (the root-node of the DOM tree)
*DocumentFragment represents a "lightweight" Document object, which can hold a portion of a document
*DocumentType provides an interface to the entities defined for the document
*ProcessingInstruction represents a processing instruction
*EntityReference represents an entity reference
*Element represents an element
*Attr represents an attribute
*Text represents textual content in an element or attribute
*CDATASection represents a
CDATA section in a document (text that will NOT be parsed by a parser)
*Comment represents a comment
*Entity represents an entity
*Notation represents a notation declared in the DTD
Node object
A node object is represented by a single node in a tree. It can be an element node, attribute node, text node, or any type that is described in section "node type". All objects can inherit properties and methods for dealing with parent and child nodes, but not all of the objects have parent or child nodes. For example, with text nodes that cannot have child nodes, trying to add child nodes results in a
DOM error.
Objects in the DOM tree may be addressed and manipulated by using methods on the objects. The public interface of a DOM is specified in its
application programming interface
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
(API). The history of the Document Object Model is intertwined with the history of the "
browser wars
A browser war is a competition for dominance in the usage share of web browsers. The "first browser war" (1995–2001) occurred between proponents of Internet Explorer and Netscape Navigator, and the "second browser war" (2004–2017) between tho ...
" of the late 1990s between
Netscape Navigator and
Microsoft Internet Explorer, as well as with that of
JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
and
JScript, the first
scripting language
In computing, a script is a relatively short and simple set of instructions that typically automation, automate an otherwise manual process. The act of writing a script is called scripting. A scripting language or script language is a programming ...
s to be widely implemented in the
layout engines of
web browser
A web browser, often shortened to browser, is an application for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's scr ...
s.
See also
*
Vertex (graph theory)
References
External links
Data Trees as a Means of Presenting Complex Data Analysisby Sally Knipe
STL-like C++ tree class{{Webarchive, url=https://web.archive.org/web/20201126210313/http://tree.phi-sci.com/ , date=2020-11-26
Description of tree data structures from ideainfo.8m.comWormWeb.org: Interactive Visualization of the ''C. elegans'' Cell Tree- Visualize the entire cell lineage tree of the nematode ''C. elegans'' (javascript)
Linked lists
Graph data structures