Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Java 9 Data Structures and Algorithms

You're reading from   Java 9 Data Structures and Algorithms A step-by-step guide to data structures and algorithms

Arrow left icon
Product type Paperback
Published in Apr 2017
Publisher Packt
ISBN-13 9781785889349
Length 340 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
 Ray Chawdhuri Ray Chawdhuri
Author Profile Icon Ray Chawdhuri
Ray Chawdhuri
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Java 9 Data Structures and Algorithms
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
1. Why Bother? – Basic FREE CHAPTER 2. Cogs and Pulleys – Building Blocks 3. Protocols – Abstract Data Types 4. Detour – Functional Programming 5. Efficient Searching – Binary Search and Sorting 6. Efficient Sorting – quicksort and mergesort 7. Concepts of Tree 8. More About Search – Search Trees and Hash Tables 9. Advanced General Purpose Data Structures 10. Concepts of Graph 11. Reactive Programming Index

The graph ADT


We will now define what a data structure representing a graph should do. Later, we will discuss the different implementations of this ADT. A graph must support the following operations:

  • Add Vertex: This adds a new vertex

  • Remove Vertex: This removes a vertex

  • Add edge: This adds a new edge; in our graph, we will allow a maximum of one edge between two vertices for simplicity

  • Remove edge: This removes an edge

  • Adjacent: This checks whether the two given vertices are adjacent to each other, that is, whether there is an edge between the given nodes

  • Neighbors: This returns a list of vertices that are adjacent to the given vertex

  • Get Vertex Value: This gets the value stored in a vertex

  • Set Vertex Value: This stores a value in a vertex

  • Get Edge Value: This gets the value stored in an edge

  • Set Edge Value: This sets the value stored in an edge

  • Is undirected: This returns whether the graph is undirected

  • Get all vertices: This returns a self-balancing binary search tree containing all the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images