Book Image

Everyday Data Structures

By : William Smith
Book Image

Everyday Data Structures

By: William Smith

Overview of this book

Explore a new world of data structures and their applications easily with this data structures book. Written by software expert William Smith, you?ll learn how to master basic and advanced data structure concepts. ? Fully understand data structures using Java, C and other common languages ? Work through practical examples and learn real-world applications ? Get to grips with data structure problem solving using case studies
Table of Contents (20 chapters)
Everyday Data Structures
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Free Chapter
1
Data Types: Foundational Structures

Graph operations


Since graphs support bidirectional references between nodes and nodes can virtually have unlimited neighbors, it is necessary to define two basic objects in order to implement the collection. These include the nodes that make up the graph as well as the graph collection itself. Optionally, an edge object may be required if the implementation supports edges that contain a value. Therefore, note that some of these common graph operations will have components in more than one class:

  • AddNode: This operation is sometimes called the AddVertex or AddPoint operation, and is dependent on the language used to define the graph. The AddNode operation simply inserts new nodes into the graph without defining any edges or references to neighboring nodes. Since a node does not necessarily need to have neighbors to exist in the graph, the AddNode operation represents an O(1) operation. Also note that the AddNode operation is exclusively implemented in the graph collection object.

  • RemoveNode...