Socket
Book a DemoInstallSign in
Socket

bracket_graph

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bracket_graph

0.0.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

BracketGraph

Bracket Graph Library.

It helps managing a graph for a single elimination bracket where each seat leads to a match that leads to a winner seat.

Single Elimination Bracket

BracketGraph::Graph.new(bracket_size)

About the Graph object

graph.root # => BracketGraph::Seat for the final match
graph.seats # => Array[BracketGraph::Seat] all nodes
graph.starting_seats # => Array[BracketGraph::Seat] all starting nodes
graph[12] # => BracketGraph::Seat with id/position 12
graph.seed(teams) # => seeds each item in the given array to a starting node
graph.seed(teams, shuffle: true) # => seeds teams after shuffle

About the Graph nodes

seat.from # Array[BracketGraph::Seat] source nodes. Empty array for a starting node
seat.to # parent node. nil for the final node
seat.position # node position id
seat.payload # custom payload that can be also seeded via BracketGraph::Graph#seed

Double Elimination Bracket

BracketGraph::DoubleEliminationGraph.new(bracket_size)

About the Graph objects

graph.root # => BracketGraph::Seat for the final match
graph.winner_graph # => BracketGraph::Graph for the the winner bracket
graph.loser_graph # => BracketGraph::LoserGraph for the the loser bracket
graph[12] # => BracketGraph::Seat with id/position 12
graph.seed(teams) # => seeds each item in the given array to a starting node in the winner_graph
graph.seed(teams, shuffle: true) # => seeds teams after shuffle

Winner Graph object

graph.winner_root # => BracketGraph::Seat for the final match of the winner bracket
graph.winner_seats # => Array[BracketGraph::Seat] all nodes of the winner bracket
graph.winner_starting_seats # => Array[BracketGraph::Seat] all starting nodes of the winner bracket

Loser Graph object

graph.loser_root # => BracketGraph::Seat for the final match of the loser bracket
graph.loser_seats # => Array[BracketGraph::Seat] all nodes of the loser bracket
graph.loser_starting_seats # => Array[BracketGraph::Seat] all starting nodes of the loser bracket

FAQs

Package last updated on 15 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.